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. More... | |
bool | fail_pfnum () |
This is called by wglGraphicsWindow when it finds it cannot use the pfnum determined by the GSG. More... | |
virtual TypeHandle | force_init_type () |
HGLRC | get_context (HDC hdc) |
Returns the GL context associated with the GSG. More... | |
const FrameBufferProperties & | get_fb_properties () const |
Returns the properties of the pixel format that was chosen for this gsg. More... | |
int | get_pfnum () const |
Returns the pixel format number chosen for windows that use this context. More... | |
void | get_properties (FrameBufferProperties &properties, HDC hdc, int pfnum) |
Gets the FrameBufferProperties to match the indicated pixel format descriptor. More... | |
bool | get_properties_advanced (FrameBufferProperties &properties, HDC hdc, int pfnum) |
Gets the FrameBufferProperties to match the indicated pixel format descriptor, using the WGL extensions. More... | |
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. More... | |
HDC | get_twindow_dc () |
Returns the DC associated with the temporary, invisible window that was created with the gsg to query WGL extensions. More... | |
virtual TypeHandle | get_type () const |
bool | made_context () const |
Returns true if the GSG has had a context made for it already, false otherwise. More... | |
bool | pfnum_supports_pbuffer () const |
Returns true if the gsg's pixel format is capable of supporting a pbuffer. More... | |
virtual void | reset () |
Resets all internal state as if the gsg were newly created. More... | |
void | restore_gamma () |
Restore original gamma. More... | |
bool | set_gamma (PN_stdfloat gamma) |
Non static version of setting gamma. More... | |
Static Public Member Functions | |
static void | atexit_function (void) |
This function is passed to the atexit function. More... | |
static TypeHandle | get_class_type () |
static bool | get_gamma_table (void) |
Static function for getting the original gamma. More... | |
static void | init_type () |
static bool | static_set_gamma (bool restore, PN_stdfloat gamma) |
Static function for setting gamma which is needed for atexit. More... | |
Friends | |
class | wglGraphicsBuffer |
A tiny specialization on GLGraphicsStateGuardian to add some wgl-specific information.
Definition at line 28 of file wglGraphicsStateGuardian.h.
|
static |
This function is passed to the atexit function.
Definition at line 913 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 250 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 81 of file wglGraphicsStateGuardian.cxx.
|
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 63 of file wglGraphicsStateGuardian.I.
|
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 42 of file wglGraphicsStateGuardian.I.
|
static |
Static function for getting the original gamma.
Definition at line 837 of file wglGraphicsStateGuardian.cxx.
|
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 22 of file wglGraphicsStateGuardian.I.
void wglGraphicsStateGuardian::get_properties | ( | FrameBufferProperties & | properties, |
HDC | hdc, | ||
int | pfnum | ||
) |
Gets the FrameBufferProperties to match the indicated pixel format descriptor.
Definition at line 97 of file wglGraphicsStateGuardian.cxx.
References FrameBufferProperties::clear(), FrameBufferProperties::set_all_specified(), FrameBufferProperties::set_color_bits, and FrameBufferProperties::set_rgba_bits().
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 153 of file wglGraphicsStateGuardian.cxx.
|
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 88 of file wglGraphicsStateGuardian.I.
|
inline |
Returns the DC associated with the temporary, invisible window that was created with the gsg to query WGL extensions.
Definition at line 75 of file wglGraphicsStateGuardian.I.
|
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 52 of file wglGraphicsStateGuardian.I.
|
inline |
Returns true if the gsg's pixel format is capable of supporting a pbuffer.
Definition at line 30 of file wglGraphicsStateGuardian.I.
|
virtual |
Resets all internal state as if the gsg were newly created.
Definition at line 456 of file wglGraphicsStateGuardian.cxx.
void wglGraphicsStateGuardian::restore_gamma | ( | ) |
Restore original gamma.
Definition at line 905 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 890 of file wglGraphicsStateGuardian.cxx.
References static_set_gamma().
|
static |
Static function for setting gamma which is needed for atexit.
Definition at line 861 of file wglGraphicsStateGuardian.cxx.
Referenced by atexit_function(), restore_gamma(), and set_gamma().