No deprecated.

svn path=/trunk/KDE/kdebase/workspace/; revision=788516
This commit is contained in:
Luboš Luňák 2008-03-21 17:50:59 +00:00
parent 9eec690d9e
commit 02aeed3de2

View file

@ -289,22 +289,12 @@ void SceneOpenGL::cleanupShm()
#endif #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 SceneOpenGL::initRenderingContext()
{ {
bool direct_rendering = options->glDirect; bool direct_rendering = options->glDirect;
if( !tfp_mode && !shm_mode ) if( !tfp_mode && !shm_mode )
direct_rendering = false; // fallback doesn't seem to work with direct rendering direct_rendering = false; // fallback doesn't seem to work with direct rendering
xerror = 0; KXErrorHandler errs1;
KXErrorHandler errs1( xerrorhandler );
ctxbuffer = glXCreateNewContext( display(), fbcbuffer, GLX_RGBA_TYPE, NULL, ctxbuffer = glXCreateNewContext( display(), fbcbuffer, GLX_RGBA_TYPE, NULL,
direct_rendering ? GL_TRUE : GL_FALSE ); direct_rendering ? GL_TRUE : GL_FALSE );
bool failed = ( ctxbuffer == NULL || !glXMakeCurrent( display(), glxbuffer, ctxbuffer )); bool failed = ( ctxbuffer == NULL || !glXMakeCurrent( display(), glxbuffer, ctxbuffer ));
@ -314,22 +304,23 @@ bool SceneOpenGL::initRenderingContext()
{ {
if( !direct_rendering ) 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; return false;
} }
glXMakeCurrent( display(), None, NULL ); glXMakeCurrent( display(), None, NULL );
if( ctxbuffer != NULL ) if( ctxbuffer != NULL )
glXDestroyContext( display(), ctxbuffer ); glXDestroyContext( display(), ctxbuffer );
direct_rendering = false; // try again direct_rendering = false; // try again
xerror = 0; KXErrorHandler errs2;
KXErrorHandler errs2( xerrorhandler );
ctxbuffer = glXCreateNewContext( display(), fbcbuffer, GLX_RGBA_TYPE, NULL, GL_FALSE ); ctxbuffer = glXCreateNewContext( display(), fbcbuffer, GLX_RGBA_TYPE, NULL, GL_FALSE );
bool failed = ( ctxbuffer == NULL || !glXMakeCurrent( display(), glxbuffer, ctxbuffer )); bool failed = ( ctxbuffer == NULL || !glXMakeCurrent( display(), glxbuffer, ctxbuffer ));
if( errs2.error( true )) if( errs2.error( true ))
failed = true; failed = true;
if( failed ) 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; return false;
} }
} }