mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
implement GLX_SGI_swap_control
This commit is contained in:
parent
00485bf6c8
commit
17c9ee24ab
@ -231,6 +231,15 @@ ConfigVariableDouble background_color
|
||||
PRC_DESC("Specifies the rgb(a) value of the default background color for a "
|
||||
"new window or offscreen buffer."));
|
||||
|
||||
ConfigVariableBool sync_video
|
||||
("sync-video", true,
|
||||
PRC_DESC("Configure this true to request the rendering to sync to the video "
|
||||
"refresh, or false to let your frame rate go as high as it can, "
|
||||
"irrespective of the video refresh. Usually you want this true, "
|
||||
"but it may be useful to set it false during development for a "
|
||||
"cheesy estimate of scene complexity. Some drivers may ignore "
|
||||
"this request."));
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: init_libdisplay
|
||||
|
@ -80,6 +80,7 @@ extern EXPCL_PANDA ConfigVariableInt stencil_bits;
|
||||
extern EXPCL_PANDA ConfigVariableInt multisamples;
|
||||
|
||||
extern EXPCL_PANDA ConfigVariableDouble background_color;
|
||||
extern EXPCL_PANDA ConfigVariableBool sync_video;
|
||||
|
||||
|
||||
extern EXPCL_PANDA void init_libdisplay();
|
||||
|
@ -75,6 +75,35 @@ glxGraphicsStateGuardian::
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: glxGraphicsStateGuardian::reset
|
||||
// Access: Public, Virtual
|
||||
// Description: Resets all internal state as if the gsg were newly
|
||||
// created.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void glxGraphicsStateGuardian::
|
||||
reset() {
|
||||
GLGraphicsStateGuardian::reset();
|
||||
|
||||
_supports_swap_control = has_extension("GLX_SGI_swap_control");
|
||||
|
||||
if (_supports_swap_control) {
|
||||
_glXSwapIntervalSGI =
|
||||
(PFNGLXSWAPINTERVALSGIPROC)get_extension_func("glX", "SwapIntervalSGI");
|
||||
if (_glXSwapIntervalSGI == NULL) {
|
||||
glxdisplay_cat.error()
|
||||
<< "Driver claims to support GLX_SGI_swap_control extension, but does not define all functions.\n";
|
||||
_supports_swap_control = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_supports_swap_control) {
|
||||
// Set the video-sync setting up front, if we have the extension
|
||||
// that supports it.
|
||||
_glXSwapIntervalSGI(sync_video ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: glxGraphicsStateGuardian::glx_is_at_least_version
|
||||
// Access: Public
|
||||
|
@ -70,6 +70,8 @@ public:
|
||||
|
||||
virtual ~glxGraphicsStateGuardian();
|
||||
|
||||
virtual void reset();
|
||||
|
||||
bool glx_is_at_least_version(int major_version, int minor_version) const;
|
||||
|
||||
GLXContext _context;
|
||||
@ -81,6 +83,10 @@ public:
|
||||
GLXFBConfig _fbconfig;
|
||||
#endif // HAVE_GLXFBCONFIG
|
||||
|
||||
public:
|
||||
bool _supports_swap_control;
|
||||
PFNGLXSWAPINTERVALSGIPROC _glXSwapIntervalSGI;
|
||||
|
||||
protected:
|
||||
virtual void get_gl_version();
|
||||
virtual void get_extra_extensions();
|
||||
|
@ -61,13 +61,6 @@ ConfigVariableBool ime_hide
|
||||
("ime-hide", false,
|
||||
PRC_DESC("Set this true to hide ime windows."));
|
||||
|
||||
ConfigVariableBool sync_video
|
||||
("sync-video", true,
|
||||
PRC_DESC("Configure this true to force the rendering to sync to the video "
|
||||
"refresh, or false to let your frame rate go as high as it can, "
|
||||
"irrespective of the video refresh (if this capability is "
|
||||
"available in the ICD)."));
|
||||
|
||||
ConfigVariableBool swapbuffer_framelock
|
||||
("swapbuffer-framelock", false,
|
||||
PRC_DESC("Set this true to enable HW swapbuffer frame-lock on 3dlabs cards"));
|
||||
|
@ -33,7 +33,6 @@ extern ConfigVariableBool ime_composition_w;
|
||||
extern ConfigVariableBool ime_aware;
|
||||
extern ConfigVariableBool ime_hide;
|
||||
|
||||
extern EXPCL_PANDAWIN ConfigVariableBool sync_video;
|
||||
extern EXPCL_PANDAWIN ConfigVariableBool swapbuffer_framelock;
|
||||
|
||||
extern EXPCL_PANDAWIN void init_libwindisplay();
|
||||
|
Loading…
x
Reference in New Issue
Block a user