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

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.

Member Function Documentation

◆ atexit_function()

void wglGraphicsStateGuardian::atexit_function ( void  )
static

This function is passed to the atexit function.

Definition at line 913 of file wglGraphicsStateGuardian.cxx.

References 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 250 of file wglGraphicsStateGuardian.cxx.

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

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

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

◆ get_gamma_table()

bool wglGraphicsStateGuardian::get_gamma_table ( void  )
static

Static function for getting the original gamma.

Definition at line 837 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 22 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 153 of file wglGraphicsStateGuardian.cxx.

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

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

◆ 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 52 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 30 of file wglGraphicsStateGuardian.I.

◆ reset()

void wglGraphicsStateGuardian::reset ( )
virtual

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

Definition at line 456 of file wglGraphicsStateGuardian.cxx.

◆ restore_gamma()

void wglGraphicsStateGuardian::restore_gamma ( )

Restore original gamma.

Definition at line 905 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 890 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 861 of file wglGraphicsStateGuardian.cxx.

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


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