move extension tests to after opengl init
This commit is contained in:
@@ -84,19 +84,6 @@ RageDisplay::RageDisplay( bool windowed, int width, int height, int bpp, int rat
|
|||||||
|
|
||||||
SetVideoMode( windowed, width, height, bpp, rate, vsync );
|
SetVideoMode( windowed, width, height, bpp, rate, vsync );
|
||||||
|
|
||||||
double fGLVersion = atof( (const char *) glGetString(GL_VERSION) );
|
|
||||||
g_glVersion = int(roundf(fGLVersion * 10));
|
|
||||||
LOG->Trace( "OpenGL version %.1f", g_glVersion / 10.);
|
|
||||||
GetGLExtensions(g_glExts);
|
|
||||||
if(g_glExts.find("GL_EXT_texture_env_combine") != g_glExts.end())
|
|
||||||
g_GL_EXT_texture_env_combine = true;
|
|
||||||
|
|
||||||
glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) SDL_GL_GetProcAddress ("glBlendFuncSeparate");
|
|
||||||
|
|
||||||
/* Windows vsync: */
|
|
||||||
if(g_glExts.find("WGL_EXT_swap_control") != g_glExts.end())
|
|
||||||
wglSwapIntervalEXT = (PWSWAPINTERVALEXTPROC) SDL_GL_GetProcAddress("wglSwapIntervalEXT");
|
|
||||||
|
|
||||||
SetupOpenGL();
|
SetupOpenGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,11 +104,31 @@ void RageDisplay::SetupOpenGL()
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
RageDisplay::~RageDisplay()
|
RageDisplay::~RageDisplay()
|
||||||
{
|
{
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RageDisplay::SetupExtensions()
|
||||||
|
{
|
||||||
|
double fGLVersion = atof( (const char *) glGetString(GL_VERSION) );
|
||||||
|
g_glVersion = int(roundf(fGLVersion * 10));
|
||||||
|
LOG->Trace( "OpenGL version %.1f", g_glVersion / 10.);
|
||||||
|
GetGLExtensions(g_glExts);
|
||||||
|
if(g_glExts.find("GL_EXT_texture_env_combine") != g_glExts.end())
|
||||||
|
g_GL_EXT_texture_env_combine = true;
|
||||||
|
|
||||||
|
glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) SDL_GL_GetProcAddress ("glBlendFuncSeparate");
|
||||||
|
|
||||||
|
/* Windows vsync: */
|
||||||
|
if(g_glExts.find("WGL_EXT_swap_control") != g_glExts.end()) {
|
||||||
|
wglSwapIntervalEXT = (PWSWAPINTERVALEXTPROC) SDL_GL_GetProcAddress("wglSwapIntervalEXT");
|
||||||
|
if(wglSwapIntervalEXT)
|
||||||
|
LOG->Trace("Got wglSwapIntervalEXT");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Set the video mode. In some cases, changing the video mode will reset
|
/* Set the video mode. In some cases, changing the video mode will reset
|
||||||
* the rendering context; returns true if we need to reload textures. */
|
* the rendering context; returns true if we need to reload textures. */
|
||||||
bool RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, int rate, bool vsync )
|
bool RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, int rate, bool vsync )
|
||||||
@@ -179,11 +186,6 @@ bool RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, i
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set vsync the Windows way, if we can. (What other extensions are there
|
|
||||||
* to do this, for other archs?) */
|
|
||||||
if(wglSwapIntervalEXT)
|
|
||||||
wglSwapIntervalEXT(vsync);
|
|
||||||
|
|
||||||
if(!g_screen) {
|
if(!g_screen) {
|
||||||
g_screen = SDL_SetVideoMode(width, height, bpp, g_flags);
|
g_screen = SDL_SetVideoMode(width, height, bpp, g_flags);
|
||||||
if(!g_screen)
|
if(!g_screen)
|
||||||
@@ -198,6 +200,16 @@ bool RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, i
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Now that we've initialized, we can search for extensions (some of which
|
||||||
|
* we may need to set up the video mode). */
|
||||||
|
SetupExtensions();
|
||||||
|
|
||||||
|
/* Set vsync the Windows way, if we can. (What other extensions are there
|
||||||
|
* to do this, for other archs?) */
|
||||||
|
if(wglSwapIntervalEXT) {
|
||||||
|
wglSwapIntervalEXT(vsync);
|
||||||
|
}
|
||||||
|
|
||||||
if(need_reload) {
|
if(need_reload) {
|
||||||
/* OpenGL state was lost; set up again. */
|
/* OpenGL state was lost; set up again. */
|
||||||
SetupOpenGL();
|
SetupOpenGL();
|
||||||
@@ -240,7 +252,7 @@ void RageDisplay::Flip()
|
|||||||
g_iVertsRenderedSinceLastCheck = 0;
|
g_iVertsRenderedSinceLastCheck = 0;
|
||||||
g_iDPF = g_iDrawsSinceLastCheck / g_iFPS;
|
g_iDPF = g_iDrawsSinceLastCheck / g_iFPS;
|
||||||
g_iDrawsSinceLastCheck = 0;
|
g_iDrawsSinceLastCheck = 0;
|
||||||
//LOG->Trace( "FPS: %d, VPF: %d, DPF: %d", m_iFPS, m_iVPF, m_iDPF );
|
LOG->Trace( "FPS: %d, VPF: %d, DPF: %d", g_iFPS, g_iVPF, g_iDPF );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ protected:
|
|||||||
void AddVerts( const RageVertex v[], int iNumVerts );
|
void AddVerts( const RageVertex v[], int iNumVerts );
|
||||||
void SetBlendMode(int src, int dst);
|
void SetBlendMode(int src, int dst);
|
||||||
void SetupOpenGL();
|
void SetupOpenGL();
|
||||||
|
void SetupExtensions();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user