Oops. Fix a silly bug on systems without paletted textures.

Fix assert failure.
This commit is contained in:
Glenn Maynard
2003-05-31 09:10:18 +00:00
parent 6707a05e0d
commit 4486bd1754
+8 -3
View File
@@ -246,8 +246,8 @@ bool HasExtension(CString ext)
static void CheckPalettedTextures()
{
// GLuint texture;
// glGenTextures(1, reinterpret_cast<GLuint*>(&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);