Re: [Plib-users] invalid OpenGL context problem
Brought to you by:
sjbaker
|
From: Stephen J B. <sj...@li...> - 2002-01-08 17:11:02
|
Roy Wood said:
> Be a bit more specific about what you mean by waiting though-- do you
> mean that within glIsValidContext(), if glXGetCurrentContext() returns
> NULL, we should literally sleep() for a second or two? Or were you
> thinking of something subtler?
Well, if your earlier diagnosis is right (I believe you said that
glXGetCurrentContext() was returning NULL because the X server
had not yet actually created the window into which the context
would be rendered)...then waiting for a second or two might well
be enough to kludge around the race condition.
I was thinking of something like:
for ( int i = 0 ; i < MAX_REDHAT_KLUDGE_DELAY ; i++ )
{
if ( glXGetCurrentContext() != NULL )
return TRUE ;
else
{
fprintf ( stderr, "Crappy RedHat distro...mumble,grumble,complain...\n");
sleep ( 1 ) ;
}
}
...print error messages, etc...
return FALSE ;
...with MAX_REDHAT_KLUDGE_DELAY set to something like 5 - or whatever
it takes to reliably fix the problem.
This won't cause any harm to existing programs and if it works around
the RedHat problem benignly, that's "A Good Thing".
----
Steve Baker (817)619-2657 (Vox/Vox-Mail)
L3Com/Link Simulation & Training (817)619-2466 (Fax)
Work: sj...@li... http://www.link.com
Home: sjb...@ai... http://www.sjbaker.org
|