diff --git a/scene_opengl.cpp b/scene_opengl.cpp index f13c9f091e..f0400941c7 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -289,22 +289,12 @@ void SceneOpenGL::cleanupShm() #endif } -// TODO replace with just KXErrorHandler::errorCode() for 4.1 -static int xerror = 0; -static bool xerrorhandler( int, int error, unsigned long ) - { - if( xerror == 0 ) - xerror = error; - return true; - } - bool SceneOpenGL::initRenderingContext() { bool direct_rendering = options->glDirect; if( !tfp_mode && !shm_mode ) direct_rendering = false; // fallback doesn't seem to work with direct rendering - xerror = 0; - KXErrorHandler errs1( xerrorhandler ); + KXErrorHandler errs1; ctxbuffer = glXCreateNewContext( display(), fbcbuffer, GLX_RGBA_TYPE, NULL, direct_rendering ? GL_TRUE : GL_FALSE ); bool failed = ( ctxbuffer == NULL || !glXMakeCurrent( display(), glxbuffer, ctxbuffer )); @@ -314,22 +304,23 @@ bool SceneOpenGL::initRenderingContext() { if( !direct_rendering ) { - kDebug( 1212 ).nospace() << "Couldn't initialize rendering context (0x" << hex << xerror << ")"; + kDebug( 1212 ).nospace() << "Couldn't initialize rendering context (" + << KXErrorHandler::errorMessage( errs1.errorEvent()) << ")"; return false; } glXMakeCurrent( display(), None, NULL ); if( ctxbuffer != NULL ) glXDestroyContext( display(), ctxbuffer ); direct_rendering = false; // try again - xerror = 0; - KXErrorHandler errs2( xerrorhandler ); + KXErrorHandler errs2; ctxbuffer = glXCreateNewContext( display(), fbcbuffer, GLX_RGBA_TYPE, NULL, GL_FALSE ); bool failed = ( ctxbuffer == NULL || !glXMakeCurrent( display(), glxbuffer, ctxbuffer )); if( errs2.error( true )) failed = true; if( failed ) { - kDebug( 1212 ).nospace() << "Couldn't initialize rendering context (0x" << hex << xerror << ")"; + kDebug( 1212 ).nospace() << "Couldn't initialize rendering context (" + << KXErrorHandler::errorMessage( errs2.errorEvent()) << ")"; return false; } }