From 0b327836979d8bcc3fdaf2dea5e76aee8f47e075 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Wed, 4 May 2011 00:26:12 -0500 Subject: [PATCH 1/3] this seems to fix the compile on Windows; not sure if it's the best way of doing it, though. --- src/RageDisplay_OGL.cpp | 12 ++++++++++- src/StepMania-net2008.vcproj | 40 ++++++++++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/RageDisplay_OGL.cpp b/src/RageDisplay_OGL.cpp index 1856705667..8bdef356c1 100644 --- a/src/RageDisplay_OGL.cpp +++ b/src/RageDisplay_OGL.cpp @@ -704,6 +704,11 @@ void RageDisplay_Legacy::ResolutionChanged() RageDisplay::ResolutionChanged(); } +#if defined(WINDOWS) + typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int ); + PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0; +#endif + // Return true if mode change was successful. // bNewDeviceOut is set true if a new device was created and textures // need to be reloaded. @@ -739,11 +744,16 @@ RString RageDisplay_Legacy::TryVideoMode( const VideoModeParams &p, bool &bNewDe InitShaders(); } + const char *extensions = reinterpret_cast(glGetString( GL_EXTENSIONS )); // I'm not sure this is correct -Colby #if defined(WINDOWS) + if( strstr( extensions, "WGL_EXT_swap_control" ) == 0 ) + return RString("The WGL_EXT_swap_control extension is not supported on your computer."); + /* Set vsync the Windows way, if we can. (What other extensions are there * to do this, for other archs?) */ - if (GLEW_WGL_EXT_swap_control) + wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress( "wglSwapIntervalEXT" ); + if (wglSwapIntervalEXT) wglSwapIntervalEXT(p.vsync); #endif diff --git a/src/StepMania-net2008.vcproj b/src/StepMania-net2008.vcproj index 88d27d87bd..53c1ab9c8a 100644 --- a/src/StepMania-net2008.vcproj +++ b/src/StepMania-net2008.vcproj @@ -51,7 +51,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=".;vorbis;libjpeg;"lua-5.1\include";ffmpeg\modern_working\include;BaseClasses;jsoncpp/include;"..\extern\glew-1.5.8\include"" - PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,WINDOWS,DEBUG" + PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,WINDOWS,DEBUG,GLEW_STATIC" ExceptionHandling="0" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -158,7 +158,7 @@ EnableIntrinsicFunctions="true" FavorSizeOrSpeed="2" AdditionalIncludeDirectories=".;vorbis;libjpeg;"lua-5.1\include";ffmpeg\modern_working\include;BaseClasses;jsoncpp/include;"..\extern\glew-1.5.8\include"" - PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,WINDOWS,RELEASE" + PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,WINDOWS,RELEASE,GLEW_STATIC" StringPooling="true" MinimalRebuild="false" ExceptionHandling="0" @@ -262,7 +262,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=".;vorbis;libjpeg;"lua-5.1\include";ffmpeg\modern_working\include;BaseClasses;jsoncpp/include;"..\extern\glew-1.5.8\include"" - PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,WINDOWS,DEBUG" + PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,WINDOWS,DEBUG,GLEW_STATIC" ExceptionHandling="0" BasicRuntimeChecks="0" RuntimeLibrary="3" @@ -369,7 +369,7 @@ EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" AdditionalIncludeDirectories=".;vorbis;libjpeg;"lua-5.1\include";ffmpeg\modern_working\include;BaseClasses;jsoncpp/include;"..\extern\glew-1.5.8\include"" - PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,WINDOWS,RELEASE" + PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,WINDOWS,RELEASE,GLEW_STATIC" StringPooling="true" MinimalRebuild="false" ExceptionHandling="0" @@ -451,6 +451,38 @@ + + + + + + + + + + + + Date: Wed, 4 May 2011 00:31:42 -0500 Subject: [PATCH 2/3] simplify like fuc --- src/RageDisplay_OGL.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/RageDisplay_OGL.cpp b/src/RageDisplay_OGL.cpp index 8bdef356c1..8f45c2a326 100644 --- a/src/RageDisplay_OGL.cpp +++ b/src/RageDisplay_OGL.cpp @@ -22,6 +22,8 @@ using namespace RageDisplay_Legacy_Helpers; #include +#include + #if defined(_MSC_VER) #pragma comment(lib, "opengl32.lib") #pragma comment(lib, "glu32.lib") @@ -704,11 +706,6 @@ void RageDisplay_Legacy::ResolutionChanged() RageDisplay::ResolutionChanged(); } -#if defined(WINDOWS) - typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int ); - PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0; -#endif - // Return true if mode change was successful. // bNewDeviceOut is set true if a new device was created and textures // need to be reloaded. @@ -744,17 +741,14 @@ RString RageDisplay_Legacy::TryVideoMode( const VideoModeParams &p, bool &bNewDe InitShaders(); } - const char *extensions = reinterpret_cast(glGetString( GL_EXTENSIONS )); // I'm not sure this is correct -Colby #if defined(WINDOWS) - if( strstr( extensions, "WGL_EXT_swap_control" ) == 0 ) - return RString("The WGL_EXT_swap_control extension is not supported on your computer."); - /* Set vsync the Windows way, if we can. (What other extensions are there * to do this, for other archs?) */ - wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress( "wglSwapIntervalEXT" ); - if (wglSwapIntervalEXT) + if( wglewIsSupported("WGL_EXT_swap_control") ) wglSwapIntervalEXT(p.vsync); + else + return RString("The WGL_EXT_swap_control extension is not supported on your computer."); #endif ResolutionChanged(); From f9514958bfebadb37953dcce1e90d1a17b8b9919 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Wed, 4 May 2011 00:33:32 -0500 Subject: [PATCH 3/3] put wglew behind #if defined(WINDOWS) --- src/RageDisplay_OGL.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/RageDisplay_OGL.cpp b/src/RageDisplay_OGL.cpp index 8f45c2a326..0b47a78bf2 100644 --- a/src/RageDisplay_OGL.cpp +++ b/src/RageDisplay_OGL.cpp @@ -22,7 +22,9 @@ using namespace RageDisplay_Legacy_Helpers; #include +#if defined(WINDOWS) #include +#endif #if defined(_MSC_VER) #pragma comment(lib, "opengl32.lib")