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
}
// 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;
}
}