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