Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
wglGraphicsStateGuardian Class Reference

A tiny specialization on GLGraphicsStateGuardian to add some wgl-specific information. More...

#include "wglGraphicsStateGuardian.h"

Inheritance diagram for wglGraphicsStateGuardian:

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 FrameBufferPropertiesget_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
 

Detailed Description

A tiny specialization on GLGraphicsStateGuardian to add some wgl-specific information.

Definition at line 28 of file wglGraphicsStateGuardian.h.

Constructor & Destructor Documentation

◆ wglGraphicsStateGuardian()

wglGraphicsStateGuardian::wglGraphicsStateGuardian ( GraphicsEngine * engine,
GraphicsPipe * pipe,
wglGraphicsStateGuardian * share_with )

Definition at line 29 of file wglGraphicsStateGuardian.cxx.

◆ ~wglGraphicsStateGuardian()

wglGraphicsStateGuardian::~wglGraphicsStateGuardian ( )
virtual

Definition at line 58 of file wglGraphicsStateGuardian.cxx.

Member Function Documentation

◆ atexit_function()

void wglGraphicsStateGuardian::atexit_function ( void )
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().

◆ choose_pixel_format()

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().

◆ fail_pfnum()

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.

◆ force_init_type()

virtual TypeHandle wglGraphicsStateGuardian::force_init_type ( )
inlinevirtual

Definition at line 131 of file wglGraphicsStateGuardian.h.

◆ get_class_type()

static TypeHandle wglGraphicsStateGuardian::get_class_type ( )
inlinestatic

Definition at line 120 of file wglGraphicsStateGuardian.h.

◆ get_context()

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 62 of file wglGraphicsStateGuardian.I.

Referenced by wglGraphicsBuffer::begin_frame(), wglGraphicsWindow::begin_frame(), wglGraphicsWindow::end_flip(), and wglGraphicsWindow::ready_flip().

◆ get_fb_properties()

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 41 of file wglGraphicsStateGuardian.I.

Referenced by PT().

◆ get_gamma_table()

bool wglGraphicsStateGuardian::get_gamma_table ( void )
static

Static function for getting the original gamma.

Definition at line 847 of file wglGraphicsStateGuardian.cxx.

◆ get_pfnum()

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 21 of file wglGraphicsStateGuardian.I.

◆ get_properties()

void wglGraphicsStateGuardian::get_properties ( FrameBufferProperties & properties,
HDC hdc,
int pfnum )

◆ get_properties_advanced()

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().

◆ get_supports_wgl_render_texture()

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 87 of file wglGraphicsStateGuardian.I.

Referenced by wglGraphicsBuffer::get_supports_render_texture().

◆ get_twindow_dc()

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 74 of file wglGraphicsStateGuardian.I.

Referenced by choose_pixel_format().

◆ get_type()

virtual TypeHandle wglGraphicsStateGuardian::get_type ( ) const
inlinevirtual

Definition at line 128 of file wglGraphicsStateGuardian.h.

◆ init_type()

static void wglGraphicsStateGuardian::init_type ( )
inlinestatic

Definition at line 123 of file wglGraphicsStateGuardian.h.

◆ made_context()

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 51 of file wglGraphicsStateGuardian.I.

◆ pfnum_supports_pbuffer()

bool wglGraphicsStateGuardian::pfnum_supports_pbuffer ( ) const
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().

◆ reset()

void wglGraphicsStateGuardian::reset ( )
virtual

Resets all internal state as if the gsg were newly created.

Definition at line 455 of file wglGraphicsStateGuardian.cxx.

◆ restore_gamma()

void wglGraphicsStateGuardian::restore_gamma ( )

Restore original gamma.

Definition at line 921 of file wglGraphicsStateGuardian.cxx.

References static_set_gamma().

◆ 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_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 871 of file wglGraphicsStateGuardian.cxx.

References atexit_function().

Referenced by atexit_function(), restore_gamma(), and set_gamma().

Friends And Related Symbol Documentation

◆ wglGraphicsBuffer

friend class wglGraphicsBuffer
friend

Definition at line 136 of file wglGraphicsStateGuardian.h.

Member Data Documentation

◆ _supports_pbuffer

bool wglGraphicsStateGuardian::_supports_pbuffer

Definition at line 98 of file wglGraphicsStateGuardian.h.

◆ _supports_pixel_format

bool wglGraphicsStateGuardian::_supports_pixel_format

Definition at line 105 of file wglGraphicsStateGuardian.h.

◆ _supports_swap_control

bool wglGraphicsStateGuardian::_supports_swap_control

Definition at line 95 of file wglGraphicsStateGuardian.h.

◆ _supports_wgl_multisample

bool wglGraphicsStateGuardian::_supports_wgl_multisample

Definition at line 110 of file wglGraphicsStateGuardian.h.

◆ _supports_wgl_render_texture

bool wglGraphicsStateGuardian::_supports_wgl_render_texture

Definition at line 112 of file wglGraphicsStateGuardian.h.

◆ _wglBindTexImageARB

PFNWGLBINDTEXIMAGEARBPROC wglGraphicsStateGuardian::_wglBindTexImageARB

Definition at line 113 of file wglGraphicsStateGuardian.h.

◆ _wglChoosePixelFormatARB

PFNWGLCHOOSEPIXELFORMATARBPROC wglGraphicsStateGuardian::_wglChoosePixelFormatARB

Definition at line 108 of file wglGraphicsStateGuardian.h.

◆ _wglCreateContextAttribsARB

PFNWGLCREATECONTEXTATTRIBSARBPROC wglGraphicsStateGuardian::_wglCreateContextAttribsARB

Definition at line 117 of file wglGraphicsStateGuardian.h.

◆ _wglCreatePbufferARB

PFNWGLCREATEPBUFFERARBPROC wglGraphicsStateGuardian::_wglCreatePbufferARB

Definition at line 99 of file wglGraphicsStateGuardian.h.

◆ _wglDestroyPbufferARB

PFNWGLDESTROYPBUFFERARBPROC wglGraphicsStateGuardian::_wglDestroyPbufferARB

Definition at line 102 of file wglGraphicsStateGuardian.h.

◆ _wglGetPbufferDCARB

PFNWGLGETPBUFFERDCARBPROC wglGraphicsStateGuardian::_wglGetPbufferDCARB

Definition at line 100 of file wglGraphicsStateGuardian.h.

◆ _wglGetPixelFormatAttribfvARB

PFNWGLGETPIXELFORMATATTRIBFVARBPROC wglGraphicsStateGuardian::_wglGetPixelFormatAttribfvARB

Definition at line 107 of file wglGraphicsStateGuardian.h.

◆ _wglGetPixelFormatAttribivARB

PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGraphicsStateGuardian::_wglGetPixelFormatAttribivARB

Definition at line 106 of file wglGraphicsStateGuardian.h.

◆ _wglQueryPbufferARB

PFNWGLQUERYPBUFFERARBPROC wglGraphicsStateGuardian::_wglQueryPbufferARB

Definition at line 103 of file wglGraphicsStateGuardian.h.

◆ _wglReleasePbufferDCARB

PFNWGLRELEASEPBUFFERDCARBPROC wglGraphicsStateGuardian::_wglReleasePbufferDCARB

Definition at line 101 of file wglGraphicsStateGuardian.h.

◆ _wglReleaseTexImageARB

PFNWGLRELEASETEXIMAGEARBPROC wglGraphicsStateGuardian::_wglReleaseTexImageARB

Definition at line 114 of file wglGraphicsStateGuardian.h.

◆ _wglSetPbufferAttribARB

PFNWGLSETPBUFFERATTRIBARBPROC wglGraphicsStateGuardian::_wglSetPbufferAttribARB

Definition at line 115 of file wglGraphicsStateGuardian.h.

◆ _wglSwapIntervalEXT

PFNWGLSWAPINTERVALEXTPROC wglGraphicsStateGuardian::_wglSwapIntervalEXT

Definition at line 96 of file wglGraphicsStateGuardian.h.


The documentation for this class was generated from the following files: