From 618a6c773740fe431bdb0cfb3fdeeee4d5eecbc0 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 26 Sep 2004 08:53:01 +0000 Subject: [PATCH] simplify, merge code --- stepmania/src/RageDisplay_OGL.cpp | 53 +++++++++---------------------- 1 file changed, 15 insertions(+), 38 deletions(-) diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 7506297515..31d754bc14 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -1714,6 +1714,19 @@ unsigned RageDisplay_OGL::CreateTexture( + { + ostringstream s; + + s << bGenerateMipMaps? "gluBuild2DMipmaps":"glTexImage2D"; + s << "(format " << GLToString(glTexFormat) << + ", " << img->w << "x" << img->h << + ", format " << GLToString(glImageFormat) << + ", type " << GLToString(glImageType) << + ", pixfmt " << pixfmt << + ", imgpixfmt " << imgpixfmt; + LOG->Trace( "%s", s.str().c_str() ); + } + FlushGLErrors(); if( bGenerateMipMaps ) @@ -1722,19 +1735,7 @@ unsigned RageDisplay_OGL::CreateTexture( GL_TEXTURE_2D, glTexFormat, img->w, img->h, glImageFormat, glImageType, img->pixels ); - - if( error != 0 ) - { - ostringstream s; - s << "gluBuild2DMipmaps(format " << GLToString(glTexFormat) << - ", w " << img->w << ", h " << img->h << - ", format " << GLToString(glImageFormat) << - ", type " << GLToString(glImageType) << - "): " << gluErrorString(error); - LOG->Trace( s.str().c_str() ); - - ASSERT(0); - } + ASSERT_M( error == 0, (char *) gluErrorString(error) ); } else { @@ -1743,35 +1744,11 @@ unsigned RageDisplay_OGL::CreateTexture( img->w, img->h, 0, glImageFormat, glImageType, img->pixels); - { - ostringstream s; - s << "glTexImage2D(format " << GLToString(glTexFormat) << - ", " << img->w << "x" << img->h << - ", format " << GLToString(glImageFormat) << - ", type " << GLToString(glImageType) << - ", pixfmt " << pixfmt << - ", imgpixfmt " << imgpixfmt; - LOG->Trace( s.str().c_str() ); - } GLenum error = glGetError(); - if( error != GL_NO_ERROR ) - { - ostringstream s; - s << "glTexImage2D(format " << GLToString(glTexFormat) << - ", " << img->w << "x" << img->h << - ", format " << GLToString(glImageFormat) << - ", type " << GLToString(glImageType) << - ", pixfmt " << pixfmt << - ", imgpixfmt " << imgpixfmt << - "): " << GLToString(error); - LOG->Trace( s.str().c_str() ); - - ASSERT(0); - } + ASSERT_M( error == GL_NO_ERROR, GLToString(error) ); } - /* Sanity check: */ if( pixfmt == FMT_PAL ) {