opengl: Add more checks and debugging info to SetSwapInterval.
This commit is contained in:
parent
f9a36b9c91
commit
199e25f3f3
|
@ -28,6 +28,10 @@
|
|||
#include <wx/glcanvas.h>
|
||||
#include <wx/utils.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma optimize( "", off )
|
||||
#endif
|
||||
|
||||
class GL_UTILS
|
||||
{
|
||||
public:
|
||||
|
@ -107,9 +111,28 @@ public:
|
|||
if( aVal == -1 && !wxGLCanvas::IsExtensionSupported( "WGL_EXT_swap_control_tear" ) )
|
||||
aVal = 1;
|
||||
|
||||
wglSwapIntervalEXT( aVal );
|
||||
const GLubyte* vendor = glGetString( GL_VENDOR );
|
||||
const GLubyte* renderer = glGetString( GL_RENDERER );
|
||||
|
||||
return wglGetSwapIntervalEXT();
|
||||
HDC hdc = wglGetCurrentDC();
|
||||
HGLRC hglrc = wglGetCurrentContext();
|
||||
|
||||
if( hdc && hglrc )
|
||||
{
|
||||
// Mostly for debugging
|
||||
wxString vendor_wx = vendor;
|
||||
wxString renderer_wx = renderer;
|
||||
|
||||
int currentInterval = wglGetSwapIntervalEXT();
|
||||
|
||||
if( currentInterval != aVal )
|
||||
{
|
||||
wglSwapIntervalEXT( aVal );
|
||||
currentInterval = wglGetSwapIntervalEXT();
|
||||
}
|
||||
|
||||
return currentInterval;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -117,4 +140,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma optimize( "", on )
|
||||
#endif
|
||||
|
||||
#endif /* GL_CONTEXT_MANAGER_H */
|
||||
|
|
Loading…
Reference in New Issue