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 |
PFNWGLCREATECONTEXTATTRIBSARBPROC | _wglCreateContextAttribsARB |
PFNWGLCREATEPBUFFERARBPROC | _wglCreatePbufferARB |
PFNWGLDESTROYPBUFFERARBPROC | _wglDestroyPbufferARB |
PFNWGLGETPBUFFERDCARBPROC | _wglGetPbufferDCARB |
PFNWGLGETPIXELFORMATATTRIBFVARBPROC | _wglGetPixelFormatAttribfvARB |
PFNWGLGETPIXELFORMATATTRIBIVARBPROC | _wglGetPixelFormatAttribivARB |
PFNWGLQUERYPBUFFERARBPROC | _wglQueryPbufferARB |
PFNWGLRELEASEPBUFFERDCARBPROC | _wglReleasePbufferDCARB |
PFNWGLRELEASETEXIMAGEARBPROC | _wglReleaseTexImageARB |
PFNWGLSETPBUFFERATTRIBARBPROC | _wglSetPbufferAttribARB |
PFNWGLSWAPINTERVALEXTPROC | _wglSwapIntervalEXT |
Friends | |
class | wglGraphicsBuffer |
A tiny specialization on GLGraphicsStateGuardian to add some wgl-specific information.
Definition at line 28 of file wglGraphicsStateGuardian.h.
wglGraphicsStateGuardian::wglGraphicsStateGuardian | ( | GraphicsEngine * | engine, |
GraphicsPipe * | pipe, | ||
wglGraphicsStateGuardian * | share_with ) |
Definition at line 29 of file wglGraphicsStateGuardian.cxx.
|
virtual |
Definition at line 58 of file wglGraphicsStateGuardian.cxx.
|
static |
This function is passed to the atexit function.
Definition at line 929 of file wglGraphicsStateGuardian.cxx.
References static_set_gamma().
Referenced by 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 249 of file wglGraphicsStateGuardian.cxx.
References get_properties(), get_properties_advanced(), FrameBufferProperties::get_quality(), get_twindow_dc(), and ConfigVariableBase::has_value().
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 80 of file wglGraphicsStateGuardian.cxx.
|
inlinevirtual |
Definition at line 131 of file wglGraphicsStateGuardian.h.
|
inlinestatic |
Definition at line 120 of file wglGraphicsStateGuardian.h.
|
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 62 of file wglGraphicsStateGuardian.I.
Referenced by wglGraphicsBuffer::begin_frame(), wglGraphicsWindow::begin_frame(), wglGraphicsWindow::end_flip(), and wglGraphicsWindow::ready_flip().
|
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 41 of file wglGraphicsStateGuardian.I.
Referenced by PT().
|
static |
Static function for getting the original gamma.
Definition at line 847 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 21 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 96 of file wglGraphicsStateGuardian.cxx.
References FrameBufferProperties::clear(), FrameBufferProperties::set_all_specified(), FrameBufferProperties::set_color_bits, and FrameBufferProperties::set_rgba_bits().
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 152 of file wglGraphicsStateGuardian.cxx.
References FrameBufferProperties::clear(), FrameBufferProperties::set_all_specified(), FrameBufferProperties::set_color_bits, and FrameBufferProperties::set_rgba_bits().
Referenced by choose_pixel_format().
|
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 87 of file wglGraphicsStateGuardian.I.
Referenced by wglGraphicsBuffer::get_supports_render_texture().
|
inline |
Returns the DC associated with the temporary, invisible window that was created with the gsg to query WGL extensions.
Definition at line 74 of file wglGraphicsStateGuardian.I.
Referenced by choose_pixel_format().
|
inlinevirtual |
Definition at line 128 of file wglGraphicsStateGuardian.h.
|
inlinestatic |
Definition at line 123 of file wglGraphicsStateGuardian.h.
|
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 51 of file wglGraphicsStateGuardian.I.
|
inline |
Returns true if the gsg's pixel format is capable of supporting a pbuffer.
Definition at line 29 of file wglGraphicsStateGuardian.I.
Referenced by PT().
|
virtual |
Resets all internal state as if the gsg were newly created.
Definition at line 455 of file wglGraphicsStateGuardian.cxx.
void wglGraphicsStateGuardian::restore_gamma | ( | ) |
Restore original gamma.
Definition at line 921 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 906 of file wglGraphicsStateGuardian.cxx.
References static_set_gamma().
|
static |
Static function for setting gamma which is needed for atexit.
Definition at line 871 of file wglGraphicsStateGuardian.cxx.
References atexit_function().
Referenced by atexit_function(), restore_gamma(), and set_gamma().
|
friend |
Definition at line 136 of file wglGraphicsStateGuardian.h.
bool wglGraphicsStateGuardian::_supports_pbuffer |
Definition at line 98 of file wglGraphicsStateGuardian.h.
bool wglGraphicsStateGuardian::_supports_pixel_format |
Definition at line 105 of file wglGraphicsStateGuardian.h.
bool wglGraphicsStateGuardian::_supports_swap_control |
Definition at line 95 of file wglGraphicsStateGuardian.h.
bool wglGraphicsStateGuardian::_supports_wgl_multisample |
Definition at line 110 of file wglGraphicsStateGuardian.h.
bool wglGraphicsStateGuardian::_supports_wgl_render_texture |
Definition at line 112 of file wglGraphicsStateGuardian.h.
PFNWGLBINDTEXIMAGEARBPROC wglGraphicsStateGuardian::_wglBindTexImageARB |
Definition at line 113 of file wglGraphicsStateGuardian.h.
PFNWGLCHOOSEPIXELFORMATARBPROC wglGraphicsStateGuardian::_wglChoosePixelFormatARB |
Definition at line 108 of file wglGraphicsStateGuardian.h.
PFNWGLCREATECONTEXTATTRIBSARBPROC wglGraphicsStateGuardian::_wglCreateContextAttribsARB |
Definition at line 117 of file wglGraphicsStateGuardian.h.
PFNWGLCREATEPBUFFERARBPROC wglGraphicsStateGuardian::_wglCreatePbufferARB |
Definition at line 99 of file wglGraphicsStateGuardian.h.
PFNWGLDESTROYPBUFFERARBPROC wglGraphicsStateGuardian::_wglDestroyPbufferARB |
Definition at line 102 of file wglGraphicsStateGuardian.h.
PFNWGLGETPBUFFERDCARBPROC wglGraphicsStateGuardian::_wglGetPbufferDCARB |
Definition at line 100 of file wglGraphicsStateGuardian.h.
PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGraphicsStateGuardian::_wglGetPixelFormatAttribfvARB |
Definition at line 107 of file wglGraphicsStateGuardian.h.
PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGraphicsStateGuardian::_wglGetPixelFormatAttribivARB |
Definition at line 106 of file wglGraphicsStateGuardian.h.
PFNWGLQUERYPBUFFERARBPROC wglGraphicsStateGuardian::_wglQueryPbufferARB |
Definition at line 103 of file wglGraphicsStateGuardian.h.
PFNWGLRELEASEPBUFFERDCARBPROC wglGraphicsStateGuardian::_wglReleasePbufferDCARB |
Definition at line 101 of file wglGraphicsStateGuardian.h.
PFNWGLRELEASETEXIMAGEARBPROC wglGraphicsStateGuardian::_wglReleaseTexImageARB |
Definition at line 114 of file wglGraphicsStateGuardian.h.
PFNWGLSETPBUFFERATTRIBARBPROC wglGraphicsStateGuardian::_wglSetPbufferAttribARB |
Definition at line 115 of file wglGraphicsStateGuardian.h.
PFNWGLSWAPINTERVALEXTPROC wglGraphicsStateGuardian::_wglSwapIntervalEXT |
Definition at line 96 of file wglGraphicsStateGuardian.h.