Panda3D
|
00001 // Filename: wglGraphicsStateGuardian.I 00002 // Created by: drose (27Jan03) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 //////////////////////////////////////////////////////////////////// 00016 // Function: wglGraphicsStateGuardian::get_pfnum 00017 // Access: Public 00018 // Description: Returns the pixel format number chosen for windows 00019 // that use this context. In OpenGL under Microsoft 00020 // Windows, the window must be created first and then 00021 // the GL context is created from the window, and the 00022 // context inherits the pixel format of the window. 00023 // Therefore, all windows that share a particular 00024 // context must also share the same pixel format. 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE int wglGraphicsStateGuardian:: 00027 get_pfnum() const { 00028 return _pfnum; 00029 } 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: wglGraphicsStateGuardian::pfnum_supports_pbuffer 00033 // Access: Public 00034 // Description: Returns true if the gsg's pixel format is capable 00035 // of supporting a pbuffer. 00036 //////////////////////////////////////////////////////////////////// 00037 INLINE bool wglGraphicsStateGuardian:: 00038 pfnum_supports_pbuffer() const { 00039 return _pfnum_supports_pbuffer; 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: wglGraphicsStateGuardian::get_fb_properties 00044 // Access: Public 00045 // Description: Returns the properties of the pixel format that 00046 // was chosen for this gsg. In OpenGL under Microsoft 00047 // Windows, the window must be created first and then 00048 // the GL context is created from the window, and the 00049 // context inherits the pixel format of the window. 00050 // Therefore, all windows that share a particular 00051 // context must also share the same pixel format. 00052 //////////////////////////////////////////////////////////////////// 00053 INLINE const FrameBufferProperties &wglGraphicsStateGuardian:: 00054 get_fb_properties() const { 00055 return _pfnum_properties; 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: wglGraphicsStateGuardian::made_context 00060 // Access: Public 00061 // Description: Returns true if the GSG has had a context made for it 00062 // already, false otherwise. If this returns false, the 00063 // next call to get_context() will quietly make a new 00064 // context. 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE bool wglGraphicsStateGuardian:: 00067 made_context() const { 00068 return _made_context; 00069 } 00070 00071 //////////////////////////////////////////////////////////////////// 00072 // Function: wglGraphicsStateGuardian::get_context 00073 // Access: Public 00074 // Description: Returns the GL context associated with the GSG. If 00075 // the context has not yet been created, this creates a 00076 // suitable context for rendering to the indicated 00077 // window. This means that this method may only be 00078 // called from within the draw thread. 00079 //////////////////////////////////////////////////////////////////// 00080 INLINE HGLRC wglGraphicsStateGuardian:: 00081 get_context(HDC hdc) { 00082 if (!_made_context) { 00083 make_context(hdc); 00084 } 00085 return _context; 00086 } 00087 00088 //////////////////////////////////////////////////////////////////// 00089 // Function: wglGraphicsStateGuardian::get_twindow_dc 00090 // Access: Public 00091 // Description: Returns the DC associated with the temporary, 00092 // invisible window that was created with the gsg to 00093 // query WGL extensions. 00094 //////////////////////////////////////////////////////////////////// 00095 INLINE HDC wglGraphicsStateGuardian:: 00096 get_twindow_dc() { 00097 if (_twindow_dc == 0) { 00098 make_twindow(); 00099 } 00100 return _twindow_dc; 00101 } 00102 00103 //////////////////////////////////////////////////////////////////// 00104 // Function: wglGraphicsStateGuardian::get_supports_wgl_render_texture 00105 // Access: Published 00106 // Description: Returns true if this particular GSG can render 00107 // from a wglGraphicsBuffer directly into a texture, or 00108 // false if it must always copy-to-texture at the end of 00109 // each frame to achieve this effect. 00110 //////////////////////////////////////////////////////////////////// 00111 INLINE bool wglGraphicsStateGuardian:: 00112 get_supports_wgl_render_texture() const { 00113 return _supports_wgl_render_texture; 00114 }