From 4486bd1754977d1888e488490a53b4d4df3c5c87 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 31 May 2003 09:10:18 +0000 Subject: [PATCH] Oops. Fix a silly bug on systems without paletted textures. Fix assert failure. --- stepmania/src/RageDisplay_OGL.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 82f841a07b..d74ef6f1ee 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -246,8 +246,8 @@ bool HasExtension(CString ext) static void CheckPalettedTextures() { -// GLuint texture; -// glGenTextures(1, reinterpret_cast(&texture)); + if( !GLExt::glColorTableEXT || !GLExt::glGetColorTableParameterivEXT ) + return; /* Check to see if paletted textures really work. */ GLenum glTexFormat = GL_PIXFMT_INFO[FMT_PAL].internalfmt; @@ -259,7 +259,6 @@ static void CheckPalettedTextures() 16, 16, 0, glImageFormat, glImageType, NULL); -// glBindTexture( GL_TEXTURE_2D, GL_PROXY_TEXTURE_2D ); CString error; GLenum glError = glGetError(); @@ -929,6 +928,12 @@ unsigned RageDisplay_OGL::CreateTexture( GLenum glImageFormat = GL_PIXFMT_INFO[pixfmt].format; GLenum glImageType = GL_PIXFMT_INFO[pixfmt].type; + /* Making an OpenGL call doesn't also flush the error state; if we happen + * to have an error from a previous call, then the assert below will fail. + * Flush it. */ + while( glGetError() != GL_NO_ERROR ) + ; + glTexImage2D(GL_TEXTURE_2D, 0, glTexFormat, img->w, img->h, 0, glImageFormat, glImageType, img->pixels);