Handle swap interval in LLW_Cocoa itself.
This commit is contained in:
@@ -14,7 +14,6 @@
|
|||||||
#else
|
#else
|
||||||
# include <OpenGL/gl.h>
|
# include <OpenGL/gl.h>
|
||||||
# include <OpenGL/glu.h>
|
# include <OpenGL/glu.h>
|
||||||
# include "VSync.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef __glext_h_
|
#undef __glext_h_
|
||||||
@@ -89,8 +88,6 @@ void GLExt_t::Load( LowLevelWindow *pWind )
|
|||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
if( HasExtension("WGL_EXT_swap_control") )
|
if( HasExtension("WGL_EXT_swap_control") )
|
||||||
wglSwapIntervalEXT = (PWSWAPINTERVALEXTPROC) pWind->GetProcAddress("wglSwapIntervalEXT");
|
wglSwapIntervalEXT = (PWSWAPINTERVALEXTPROC) pWind->GetProcAddress("wglSwapIntervalEXT");
|
||||||
#elif defined(MACOSX)
|
|
||||||
wglSwapIntervalEXT = OSXSwapIntervalEXT;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( HasExtension("GL_EXT_paletted_texture") )
|
if( HasExtension("GL_EXT_paletted_texture") )
|
||||||
|
|||||||
@@ -118,8 +118,15 @@ static void SetOGLParameters( NSOpenGLContext *context )
|
|||||||
|
|
||||||
CString LowLevelWindow_Cocoa::TryVideoMode( const VideoModeParams& p, bool& newDeviceOut )
|
CString LowLevelWindow_Cocoa::TryVideoMode( const VideoModeParams& p, bool& newDeviceOut )
|
||||||
{
|
{
|
||||||
|
// Always set these params.
|
||||||
|
mCurrentParams.bSmoothLines = p.bSmoothLines;
|
||||||
|
mCurrentParams.bTrilinearFiltering = p.bTrilinearFiltering;
|
||||||
|
mCurrentParams.bAnisotropicFiltering = p.bAnisotropicFiltering;
|
||||||
|
mCurrentParams.interlaced = p.interlaced;
|
||||||
|
mCurrentParams.PAL = p.PAL;
|
||||||
|
|
||||||
#define X(x) p.x == mCurrentParams.x
|
#define X(x) p.x == mCurrentParams.x
|
||||||
if( X(windowed) && X(bpp) && X(width) && X(height) && X(rate) )
|
if( X(windowed) && X(bpp) && X(width) && X(height) && X(rate) && X(vsync) )
|
||||||
return 0;
|
return 0;
|
||||||
#undef X
|
#undef X
|
||||||
|
|
||||||
@@ -231,11 +238,13 @@ CString LowLevelWindow_Cocoa::TryVideoMode( const VideoModeParams& p, bool& newD
|
|||||||
}
|
}
|
||||||
SetOGLParameters( mFullScreenContext );
|
SetOGLParameters( mFullScreenContext );
|
||||||
}
|
}
|
||||||
|
long swap = p.vsync ? 1 : 0;
|
||||||
|
|
||||||
|
[mFullScreenContext setValues:&swap forParameter:NSOpenGLCPSwapInterval];
|
||||||
[mFullScreenContext setFullScreen];
|
[mFullScreenContext setFullScreen];
|
||||||
[mFullScreenContext update];
|
[mFullScreenContext update];
|
||||||
[mFullScreenContext makeCurrentContext];
|
[mFullScreenContext makeCurrentContext];
|
||||||
// Copy the rest of the state
|
mCurrentParams.vsync = p.vsync;
|
||||||
mCurrentParams = p;
|
|
||||||
|
|
||||||
newDeviceOut = newDeviceOut || !mSharingContexts;
|
newDeviceOut = newDeviceOut || !mSharingContexts;
|
||||||
return CString();
|
return CString();
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
#include "Vsync.h"
|
|
||||||
#include <OpenGl/OpenGl.h>
|
|
||||||
|
|
||||||
|
|
||||||
bool OSXSwapIntervalEXT( int swapInterval )
|
|
||||||
{
|
|
||||||
return !CGLSetParameter( CGLGetCurrentContext(), kCGLCPSwapInterval, (long*)(&swapInterval) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (c) 2003-2004 Steve Checkoway
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the
|
|
||||||
* "Software"), to deal in the Software without restriction, including
|
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
||||||
* whom the Software is furnished to do so, provided that the above
|
|
||||||
* copyright notice(s) and this permission notice appear in all copies of
|
|
||||||
* the Software and that both the above copyright notice(s) and this
|
|
||||||
* permission notice appear in supporting documentation.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
||||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
||||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
||||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
||||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
||||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#ifndef VSYNC_H
|
|
||||||
#define VSYNC_H
|
|
||||||
|
|
||||||
bool OSXSwapIntervalEXT( int swapInterval );
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (c) 2003-2004 Steve Checkoway
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the
|
|
||||||
* "Software"), to deal in the Software without restriction, including
|
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
||||||
* whom the Software is furnished to do so, provided that the above
|
|
||||||
* copyright notice(s) and this permission notice appear in all copies of
|
|
||||||
* the Software and that both the above copyright notice(s) and this
|
|
||||||
* permission notice appear in supporting documentation.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
||||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
||||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
||||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
||||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
||||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
Reference in New Issue
Block a user