Re: [Plib-users] Re: flightgear problem
Brought to you by:
sjbaker
From: Stephen L. <le...@na...> - 2001-09-01 18:00:46
|
Steve Baker, Thank you for a good answer. Response embedded... Stephen Lewis Steve Baker wrote: > > Stephen Lewis wrote: > > > > Gentlemen, > > I have joined this list because I have the "flightgear" problem. > > I have just read a weeks worth of discussion concerning the > > "ssgInit called without a valid OpenGL context". I tried to compile > > FlighGear 0.7.8 on a PowerPC running YellowDogLinux 2.0. > > Although based on RH 7 there is no MMX and the compiler is 2.95.3 > > That's interesting new information. Which OpenGL version do you have? I believe GL version 1.2 from Mesa 3.4 > > > There has been much speculation and not much science in this discussion. > > Well, there has been science to the extent that I personally can provide > science. The facts I have to date are: > > * glXGetCurrentContext is returning NULL > * ...which is *SUPPOSED* to mean that there isn't a > valid OpenGL rendering context. > * But we demonstrably *DO* have a rendering context at that > point because we can comment out the glXGetCurrentContext and > the program runs correctly. > * The exact same sequence of instructions when run on other OpenGL > implementations (eg nVidia's) and/or other windowing systems (eg Windoze) > and/or different C++ compilers (eg 2.95.2) *DOES* result in a valid > result from glXGetCurrentContext. > * This same problem shows up in other OpenGL programs that test > glXGetCurrentContext...not just PLIB programs. > * Up until today, every instance of the problem had been on > systems running Mesa under RH 7.x or Mandrake 8.x. I've never > heard of such a system that worked - or of any other system that > didn't work. > > So, what are we to deduce from these facts? > > I'm inclined to believe therefore that this is some kind of an underlying > bug in the windowing system or OpenGL implementation...probably the latter... > caused by *something* unique to RH implementations (and other systems that > share something with it). > > I'm currently working under the presumption that the "known-to-be-dubious" > C++ compiler (GCC 2.96/2.97) is mis-compiling Mesa in some subtle manner > that causes glXGetCurrentContext to fail. That theory seems to fit the > facts better than anything else that's been suggested - but it's certainly > not proven. > > The scientific method says that the next thing to do is a controlled experiment > to test predictions made by this theory. But since I run SuSE and have only an > nVidia graphics card, I don't see the problem, I can't easily/cheaply do that. > > Since this is plainly not a problem with anything I've written, it's really > not my problem to solve. The issue belongs (IMHO) in the Mesa mailing list... I agree with this and will forward my findings to them. The problem seems to me to be in 'glXGetCurrentContext' > however, I'm subscribed to that list and so far I don't recollect anyone > complaining there. > > In the realm of OpenSource software, if you don't tell the right person > the right problem, it won't ever get fixed. (Although it may just "go away" > of it's own accord - as I suspect this will). > > So - that was before seeing your email. > > Now we see another RedHat 7 derivitive with the problem - but NOT with > the 2.96/2.97 compiler. That's interesting - and probably deflates my > "broken compiler" theory...although not entirely since most non-RH x86 > users are on 2.95.2 and you are using 2.95.3 - and on a different CPU > architecture. > > What other things might be common between these broken systems? I have taken a peek at the source for 'glXGetCurrentContext' and its full of #ifdefs and on my platform appears to return NULL regardless. The differences between implementations is probably local #defines and config files including such things as DIRECT/INDIRECT rendering, PTHREADS, and complicated deferred execution and mutex code between X and GL. I'm going to wade through the code but its ugly. > > What Xfree version are you all running? Is anyone else running that > version with the same version of Mesa and NOT seeing the problem? > Mine is XFree86 4.0.2-6e built by YDL (terrasoft) > > I compiled the plib_examples and get the same message from > > examples/src/ssg/tux/tux_example and examples/src/ssg/viewer/viewer > > Further investigation indicates that *after* calling 'glutCreateWindow' > > there is no valid OpenGL context according to 'ssgInit'. How does > > ssgInit > > determine this? It calls 'glXGetCurrentContext' which returns NULL even > > though 'glutCreateWindow' thinks it has created a valid context.. > > Thus the root of the problem is an incompatibility between: > > 'glutCreateWindow' and 'glXGetCurrentContext'. > > Actually, you can get the same bug using 'freeglut' and in PPE which > doesn't use GLUT at all. Hence it's not glutCreateWindow itself > but whatever underlying X11 call is common to FLTK and GLUT/freeglut... > XCreateWindow being the most likely candidate. I'll check that - maybe can get problem without GLUT - just within GLX - that would narrow it down a bit. > > > 'ssgInit' doesn't > > have much to do with it except that it generates the error message. > > Indeed. Which is why this is the wrong mailing list to report the > problem to. True - but there was a lot of discussion and (unfortunately) you are going to get the calls because you generate the message :-) > > > It is easier to debug a small program with these two calls than > > to begin with FlightGear... > > Yes - something like that would be useful. Unfortunately, I can't > write that program because I don't have a system that exhibits the > bug. I can. see attached > > > Now my question, to which groups should this information be directed? > > I suggest the Mesa mailing list. You can find info on how to subscribe > on www.mesa3d.org. I'd greatly appreciate it if you would first write > that 10 line test program so that the problem can be expressed in a > manner that won't result in it being immediately reflected back onto > this list as a PLIB problem. I couldn't get it into 10 lines but its under 60. No PLIB code either. > > > Platform Macintosh G4 Cube and YellowDogLinux 2.0 > > OpenGL 1.2, Mesa 3.4 and GLUT 3.7 > > What 3D hardware do you have? apparently "ATI Rage 128 Pro PF (AGP)" > > ----------------------------- Steve Baker ------------------------------- > HomeMail : <sjb...@ai...> WorkMail: <sj...@li...> > HomePage : http://web2.airmail.net/sjbaker1 > Projects : http://plib.sf.net http://tuxaqfh.sf.net > http://prettypoly.sf.net http://tuxkart.sf.net > http://freeglut.sf.net http://toobular.sf.net =============================cut here======================================= /* Copyright (c) 2001 Stephen Lewis */ /* modified 31-Aug-2001 */ /* Illustrates a problem with OpenGL context comments please to 'le...@na...' gcc -O2 -Wall -c -o main.o main.c gcc -O2 -Wall -lglut -lGL -lGLU -lm -o main main.o ./main */ #include <stdlib.h> #include <stdio.h> #include <GL/glut.h> #include <GL/glx.h> void reshape ( int w, int h ) { glViewport ( 0, 0, w, h ) ; } void keyboard ( unsigned char key, int x, int y) { exit ( 0 ) ; /* exit for any key */ } void redraw () { glClearColor( 1.0, 0.5, 0.0, 0.0 ); glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ; glutSwapBuffers (); } int main(int argc, char **argv) { int fake_argc = 1 ; char *fake_argv[3] ; fake_argv[0] = "SL_Test" ; fake_argv[1] = "SL Example Program." ; fake_argv[2] = NULL ; /* Initialise GLUT */ glutInitWindowPosition (10, 10); glutInitWindowSize ( 640, 480 ) ; glutInit ( &fake_argc, fake_argv ) ; glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ) ; glutCreateWindow ( fake_argv[1] ) ; /* without next two callbacks - get fatal error from glutMainLoop */ glutDisplayFunc ( redraw ) ; glutReshapeFunc ( reshape ) ; glutKeyboardFunc ( keyboard ) ; /* Check the context */ if (glXGetCurrentContext() == NULL) { printf("SL_Test: glXGetCurrentContext returns NULL\n"); printf("SL_Test: This is incorrect\n"); } else { printf("SL_Test: glXGetCurrentContext returns SOMETHING\n"); printf("SL_Test: This is (presumably) the correct context\n"); }; glutMainLoop (); return 0; } =============================cut here======================================= |