Hi All, This is a 'fix' to sgscreen library, for those with a glX extension implementation that still reports version 1.2...
Wow, I got there!!! Boy I love coding when you persist, and try, and try some more, and you discover what makes it work ;=)) even when you do not fully 'understand' all that is happening... The discovery : (a) While my installed implementation of the service :- glXQueryVersion(dpy, &major, &minor) returns 1.2, it none the less supports many features, services of 1.3! (b) While my installed implementation of - const char* extString = glXQueryExtensionsString(dpy, screen); does NOT contain the string "GLX_SGIX_pbuffer", BUT a call to the service :- const char * extClient = glXGetClientString(dpy,GLX_EXTENSIONS); DOES... This can be seen when running 'glxinfo'... so I added this and continued... (c) Although the documentation for the service glXCreateGLXPbuffer seems to indicate that a NULL attribute pointer can be used, this produced a segfault in my system, so I add a pointer to attributes (which had already been declared, except I had to move it to a higher context)... But in my case it still reported an X error, but at least not a segfault, so... (d) Since my implementation returns 1.2, the code logic of - if (((1 <= major && 3 <= minor) || 2 <= major) && ... naturally stops 'glXVersion1_3Present' being set TRUE, even though ALL the 1.3+ functions are resolved using SGLookupFunction("glXChooseFBConfig"), etc And the code then seeks 'alternate' functions, like SGLookupFunction("glXChooseFBConfigSGIX"); which are also _ALL_ found, but yield 'bad' results when used... So in 2 places in the code, I overrode the simple if ( glXVersion1_3Present ), which is false in my case, with more logic :- Reasoning: If the 1.3 pointers are resolved, then use them, instead of the old, failing!, 1.2 functions... 1.// if (glXVersion1_3Present) if (glXCreatePbufferPtr && glXGetVisualFromFBConfigPtr && glXCreateContextPtr) { 2.// if (!glXVersion1_3Present) if ((!glXCreatePbufferPtr || !glXGetVisualFromFBConfigPtr || ! glXCreateContextPtr) && (!glXVersion1_3Present)) { BUT, this did NOT work in a 3rd case I tried : --------------------------------------------- // if (glXVersion1_3Present) if ((glXVersion1_3Present) || (glXCreatePbufferPtr && glXGetVisualFromFBConfigPtr && glXCreateContextPtr && glXQueryDrawablePtr)) so left this back the way it was... the GLXDrawable draw = glXGetCurrentDrawable(); worked, but the glXQueryDrawablePtr for GLX_WIDTH and GLX_HEIGHT FAILED, and exited, with an X error. AND glXQueryGLXPbufferSGIXPtr(...) with GLX_WIDTH_SGIX and GLX_HEIGHT_SGIX also FAILED with - X Error of failed request: GLXBadPixmap This seems troublesome in that _iWidth and _iHeight are left as per the buffer request, and not adjusted if the buffer size is different to that requested. But, on checking further, at the time this is done, the context and buffer has been returned to the original, so I see no reason, or problem, that this code has been 'chopped' ;=() ------------------------------------------- *** =========================== *** THEN IT ALL WORKED ;=)) *** =========================== When I run TestRenderTexture I have a spinning rectangle, containing a spinning torus, and can toggle each of the init strings (with the enter key) - most work, but some do not, but I suspect this is true in ALL cases, environments. And the space bar toggles the color/depth and effects some images, but not all... which I think is correct. The FIX : -------- To get here I added over 100 dbg_printf statements, and hope that these are kept to help future debugging. They can ALL be defined away with - #define dbg_printf or enabled anytime with - #define dbg_print printf Some of these are in addition to an existing SG_LOG(), but since the application TestRenderTexture does NOT 'enable' sglog(), then none of these show... hence the simple 'dbg_printf' alternative added... And some other debug code depends on _DEBUG being defined... This includes a big block of DEBUG code added to the end of the file. Version: Also, for no particular reason I did all these changes first on SimGear-1.9.0, but was pleased to note that there are NO CVS changes to the files changed, so the attached 'patch' can be applied directly to SG CVS... Which is what I have done to my local cvs copy, and the diff attached is using - ...simgear/source $ cvs diff -u If someone would like to check my work, I would be pleased to answer any question as to why this, or that... And of course, those that had the good luck to have the TestRenderTexture working in their system need to re-check that nothing I did effects it still working in their system... more reason to KEEP the copious 'debug' code in place... In most places, I only touched code in the NOT _WIN32, NOT __MACH__ sections, so only *nix code should be effected. Use: Of course, I have tested the new sgscreen static library with Atlas/Map, and now my Map also works flawlessly... ;=)) So the ONLY remaining thing is to get these changes into SG CVS so the 'torus' can continue to spin ;=)) Regards, Geoff. attached: oops, not attached - too big 40KB++ so only available - online: http://geoffair.net/tmp/sg-rt-diff.patch ------------------------------------------------------------------------------ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel