Panda3D
wglGraphicsStateGuardian.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file wglGraphicsStateGuardian.I
10  * @author drose
11  * @date 2003-01-27
12  */
13 
14 /**
15  * Returns the pixel format number chosen for windows that use this context.
16  * In OpenGL under Microsoft Windows, the window must be created first and
17  * then the GL context is created from the window, and the context inherits
18  * the pixel format of the window. Therefore, all windows that share a
19  * particular context must also share the same pixel format.
20  */
22 get_pfnum() const {
23  return _pfnum;
24 }
25 
26 /**
27  * Returns true if the gsg's pixel format is capable of supporting a pbuffer.
28  */
31  return _pfnum_supports_pbuffer;
32 }
33 
34 /**
35  * Returns the properties of the pixel format that was chosen for this gsg.
36  * In OpenGL under Microsoft Windows, the window must be created first and
37  * then the GL context is created from the window, and the context inherits
38  * the pixel format of the window. Therefore, all windows that share a
39  * particular context must also share the same pixel format.
40  */
43  return _pfnum_properties;
44 }
45 
46 /**
47  * Returns true if the GSG has had a context made for it already, false
48  * otherwise. If this returns false, the next call to get_context() will
49  * quietly make a new context.
50  */
52 made_context() const {
53  return _made_context;
54 }
55 
56 /**
57  * Returns the GL context associated with the GSG. If the context has not yet
58  * been created, this creates a suitable context for rendering to the
59  * indicated window. This means that this method may only be called from
60  * within the draw thread.
61  */
62 INLINE HGLRC wglGraphicsStateGuardian::
63 get_context(HDC hdc) {
64  if (!_made_context) {
65  make_context(hdc);
66  }
67  return _context;
68 }
69 
70 /**
71  * Returns the DC associated with the temporary, invisible window that was
72  * created with the gsg to query WGL extensions.
73  */
76  if (_twindow_dc == 0) {
77  make_twindow();
78  }
79  return _twindow_dc;
80 }
81 
82 /**
83  * Returns true if this particular GSG can render from a wglGraphicsBuffer
84  * directly into a texture, or false if it must always copy-to-texture at the
85  * end of each frame to achieve this effect.
86  */
89  return _supports_wgl_render_texture;
90 }
HDC get_twindow_dc()
Returns the DC associated with the temporary, invisible window that was created with the gsg to query...
int get_pfnum() const
Returns the pixel format number chosen for windows that use this context.
bool made_context() const
Returns true if the GSG has had a context made for it already, false otherwise.
bool get_supports_wgl_render_texture() const
Returns true if this particular GSG can render from a wglGraphicsBuffer directly into a texture,...
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.
bool pfnum_supports_pbuffer() const
Returns true if the gsg's pixel format is capable of supporting a pbuffer.
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...