Panda3D
|
A tiny specialization on GLGraphicsStateGuardian to add some wgl-specific information. More...
#include "wglGraphicsStateGuardian.h"
Public Member Functions | |
wglGraphicsStateGuardian (GraphicsEngine *engine, GraphicsPipe *pipe, wglGraphicsStateGuardian *share_with) | |
void | choose_pixel_format (const FrameBufferProperties &properties, bool need_pbuffer) |
Selects a pixel format for all the windows and buffers that use this gsg. | |
bool | fail_pfnum () |
This is called by wglGraphicsWindow when it finds it cannot use the pfnum determined by the GSG. | |
virtual TypeHandle | force_init_type () |
HGLRC | get_context (HDC hdc) |
Returns the GL context associated with the GSG. | |
const FrameBufferProperties & | get_fb_properties () const |
Returns the properties of the pixel format that was chosen for this gsg. | |
int | get_pfnum () const |
Returns the pixel format number chosen for windows that use this context. | |
void | get_properties (FrameBufferProperties &properties, HDC hdc, int pfnum) |
Gets the FrameBufferProperties to match the indicated pixel format descriptor. | |
bool | get_properties_advanced (FrameBufferProperties &properties, HDC hdc, int pfnum) |
Gets the FrameBufferProperties to match the indicated pixel format descriptor, using the WGL extensions. | |
bool | get_supports_wgl_render_texture () const |
Returns true if this particular GSG can render from a wglGraphicsBuffer directly into a texture, or false if it must always copy-to-texture at the end of each frame to achieve this effect. | |
HDC | get_twindow_dc () |
Returns the DC associated with the temporary, invisible window that was created with the gsg to query WGL extensions. | |
virtual TypeHandle | get_type () const |
bool | made_context () const |
Returns true if the GSG has had a context made for it already, false otherwise. | |
bool | pfnum_supports_pbuffer () const |
Returns true if the gsg's pixel format is capable of supporting a pbuffer. | |
virtual void | reset () |
Resets all internal state as if the gsg were newly created. | |
void | restore_gamma () |
Restore original gamma. | |
bool | set_gamma (PN_stdfloat gamma) |
Non static version of setting gamma. | |
Static Public Member Functions | |
static void | atexit_function (void) |
This function is passed to the atexit function. | |
static TypeHandle | get_class_type () |
static bool | get_gamma_table (void) |
Static function for getting the original gamma. | |
static void | init_type () |
static bool | static_set_gamma (bool restore, PN_stdfloat gamma) |
Static function for setting gamma which is needed for atexit. | |
Public Attributes | |
bool | _supports_pbuffer |
bool | _supports_pixel_format |
bool | _supports_swap_control |
bool | _supports_wgl_multisample |
bool | _supports_wgl_render_texture |
PFNWGLBINDTEXIMAGEARBPROC | _wglBindTexImageARB |
PFNWGLCHOOSEPIXELFORMATARBPROC | _wglChoosePixelFormatARB |
PFNWGLCREATEPBUFFERARBPROC | _wglCreatePbufferARB |
PFNWGLDESTROYPBUFFERARBPROC | _wglDestroyPbufferARB |
PFNWGLGETPBUFFERDCARBPROC | _wglGetPbufferDCARB |
PFNWGLGETPIXELFORMATATTRIBFVARBPROC | _wglGetPixelFormatAttribfvARB |
PFNWGLGETPIXELFORMATATTRIBIVARBPROC | _wglGetPixelFormatAttribivARB |
PFNWGLQUERYPBUFFERARBPROC | _wglQueryPbufferARB |
PFNWGLRELEASEPBUFFERDCARBPROC | _wglReleasePbufferDCARB |
PFNWGLRELEASETEXIMAGEARBPROC | _wglReleaseTexImageARB |
PFNWGLSETPBUFFERATTRIBARBPROC | _wglSetPbufferAttribARB |
PFNWGLSWAPINTERVALEXTPROC | _wglSwapIntervalEXT |
Protected Member Functions | |
virtual void * | do_get_extension_func (const char *prefix, const char *name) |
Returns the pointer to the GL extension function with the indicated name. | |
virtual void | get_extra_extensions () |
This may be redefined by a derived class (e.g. | |
Friends | |
class | wglGraphicsBuffer |
A tiny specialization on GLGraphicsStateGuardian to add some wgl-specific information.
Definition at line 31 of file wglGraphicsStateGuardian.h.
void wglGraphicsStateGuardian::atexit_function | ( | void | ) | [static] |
This function is passed to the atexit function.
Definition at line 927 of file wglGraphicsStateGuardian.cxx.
References static_set_gamma().
void wglGraphicsStateGuardian::choose_pixel_format | ( | const FrameBufferProperties & | properties, |
bool | need_pbuffer | ||
) |
Selects a pixel format for all the windows and buffers that use this gsg.
Definition at line 259 of file wglGraphicsStateGuardian.cxx.
References get_extra_extensions(), get_properties(), get_properties_advanced(), FrameBufferProperties::get_quality(), get_twindow_dc(), and ConfigVariableBase::has_value().
Referenced by wglGraphicsBuffer::open_buffer(), and wglGraphicsWindow::open_window().
void * wglGraphicsStateGuardian::do_get_extension_func | ( | const char * | prefix, |
const char * | name | ||
) | [protected, virtual] |
Returns the pointer to the GL extension function with the indicated name.
It is the responsibility of the caller to ensure that the required extension is defined in the OpenGL runtime prior to calling this; it is an error to call this for a function that is not defined.
Definition at line 586 of file wglGraphicsStateGuardian.cxx.
bool wglGraphicsStateGuardian::fail_pfnum | ( | ) |
This is called by wglGraphicsWindow when it finds it cannot use the pfnum determined by the GSG.
Assuming this pfnum corresponds to an "advanced" frame buffer determined by wglChoosePixelFormatARB, this asks the GSG to swap out that pfnum for the earlier, "preliminary" pfnum determined via DescribePixelFormat().
This is a one-way operation. Once called, you can never go back to the advanced pfnum.
This method returns true if a change was successfully made, or false if there was no second tier to fall back to.
Definition at line 87 of file wglGraphicsStateGuardian.cxx.
Referenced by wglGraphicsWindow::open_window().
HGLRC wglGraphicsStateGuardian::get_context | ( | HDC | hdc | ) | [inline] |
Returns the GL context associated with the GSG.
If the context has not yet been created, this creates a suitable context for rendering to the indicated window. This means that this method may only be called from within the draw thread.
Definition at line 81 of file wglGraphicsStateGuardian.I.
Referenced by wglGraphicsWindow::begin_frame(), wglGraphicsBuffer::begin_frame(), wglGraphicsWindow::end_flip(), wglGraphicsBuffer::open_buffer(), wglGraphicsWindow::open_window(), and wglGraphicsWindow::ready_flip().
void wglGraphicsStateGuardian::get_extra_extensions | ( | ) | [protected, virtual] |
This may be redefined by a derived class (e.g.
glx or wgl) to get whatever further extensions strings may be appropriate to that interface, in addition to the GL extension strings return by glGetString().
Definition at line 550 of file wglGraphicsStateGuardian.cxx.
Referenced by choose_pixel_format().
const FrameBufferProperties & wglGraphicsStateGuardian::get_fb_properties | ( | ) | const [inline] |
Returns the properties of the pixel format that was chosen for this gsg.
In OpenGL under Microsoft Windows, the window must be created first and then the GL context is created from the window, and the context inherits the pixel format of the window. Therefore, all windows that share a particular context must also share the same pixel format.
Definition at line 54 of file wglGraphicsStateGuardian.I.
Referenced by wglGraphicsBuffer::open_buffer(), and wglGraphicsWindow::open_window().
bool wglGraphicsStateGuardian::get_gamma_table | ( | void | ) | [static] |
Static function for getting the original gamma.
Definition at line 841 of file wglGraphicsStateGuardian.cxx.
int wglGraphicsStateGuardian::get_pfnum | ( | ) | const [inline] |
Returns the pixel format number chosen for windows that use this context.
In OpenGL under Microsoft Windows, the window must be created first and then the GL context is created from the window, and the context inherits the pixel format of the window. Therefore, all windows that share a particular context must also share the same pixel format.
Definition at line 27 of file wglGraphicsStateGuardian.I.
Referenced by wglGraphicsWindow::open_window().
void wglGraphicsStateGuardian::get_properties | ( | FrameBufferProperties & | properties, |
HDC | hdc, | ||
int | pfnum | ||
) |
Gets the FrameBufferProperties to match the indicated pixel format descriptor.
Definition at line 105 of file wglGraphicsStateGuardian.cxx.
References FrameBufferProperties::clear(), and FrameBufferProperties::set_all_specified().
Referenced by choose_pixel_format().
bool wglGraphicsStateGuardian::get_properties_advanced | ( | FrameBufferProperties & | properties, |
HDC | hdc, | ||
int | pfnum | ||
) |
Gets the FrameBufferProperties to match the indicated pixel format descriptor, using the WGL extensions.
Definition at line 167 of file wglGraphicsStateGuardian.cxx.
References FrameBufferProperties::clear(), and FrameBufferProperties::set_all_specified().
Referenced by choose_pixel_format().
bool wglGraphicsStateGuardian::get_supports_wgl_render_texture | ( | ) | const [inline] |
Returns true if this particular GSG can render from a wglGraphicsBuffer directly into a texture, or false if it must always copy-to-texture at the end of each frame to achieve this effect.
Definition at line 112 of file wglGraphicsStateGuardian.I.
Referenced by wglGraphicsBuffer::get_supports_render_texture().
HDC wglGraphicsStateGuardian::get_twindow_dc | ( | ) | [inline] |
Returns the DC associated with the temporary, invisible window that was created with the gsg to query WGL extensions.
Definition at line 96 of file wglGraphicsStateGuardian.I.
Referenced by choose_pixel_format(), and wglGraphicsBuffer::open_buffer().
bool wglGraphicsStateGuardian::made_context | ( | ) | const [inline] |
Returns true if the GSG has had a context made for it already, false otherwise.
If this returns false, the next call to get_context() will quietly make a new context.
Definition at line 67 of file wglGraphicsStateGuardian.I.
bool wglGraphicsStateGuardian::pfnum_supports_pbuffer | ( | ) | const [inline] |
Returns true if the gsg's pixel format is capable of supporting a pbuffer.
Definition at line 38 of file wglGraphicsStateGuardian.I.
Referenced by wglGraphicsBuffer::open_buffer().
void wglGraphicsStateGuardian::reset | ( | ) | [virtual] |
Resets all internal state as if the gsg were newly created.
Definition at line 455 of file wglGraphicsStateGuardian.cxx.
Restore original gamma.
Definition at line 917 of file wglGraphicsStateGuardian.cxx.
References static_set_gamma().
bool wglGraphicsStateGuardian::set_gamma | ( | PN_stdfloat | gamma | ) |
Non static version of setting gamma.
Returns true on success.
Definition at line 900 of file wglGraphicsStateGuardian.cxx.
References static_set_gamma().
bool wglGraphicsStateGuardian::static_set_gamma | ( | bool | restore, |
PN_stdfloat | gamma | ||
) | [static] |
Static function for setting gamma which is needed for atexit.
Definition at line 868 of file wglGraphicsStateGuardian.cxx.
Referenced by atexit_function(), restore_gamma(), and set_gamma().