From 504866debb6dade1062668478610cc4ed5191f38 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 21 Mar 2007 04:51:47 +0000 Subject: [PATCH] Allow passing a surface with no data and non-power-of-two dimensions. A power-of-two texture will be created and not initialized. --- stepmania/src/RageDisplay_OGL.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 3de9005874..64ab4a82e8 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -1963,7 +1963,6 @@ unsigned RageDisplay_OGL::CreateTexture( bool bGenerateMipMaps ) { ASSERT( pixfmt < NUM_PixelFormat ); - ASSERT( pImg->w == power_of_two(pImg->w) && pImg->h == power_of_two(pImg->h) ); /* Find the pixel format of the surface we've been given. */ @@ -2089,8 +2088,13 @@ unsigned RageDisplay_OGL::CreateTexture( { glTexImage2D( GL_TEXTURE_2D, 0, glTexFormat, - pImg->w, pImg->h, 0, - glImageFormat, glImageType, pImg->pixels); + power_of_two(pImg->w), power_of_two(pImg->h), 0, + glImageFormat, glImageType, NULL ); + if( pImg->pixels ) + glTexSubImage2D( GL_TEXTURE_2D, 0, + 0, 0, + pImg->w, pImg->h, + glImageFormat, glImageType, pImg->pixels ); GLenum error = glGetError(); ASSERT_M( error == GL_NO_ERROR, GLToString(error) );