Re: [Plib-devel] commandline conversion program
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2005-01-09 16:59:03
|
br...@sa... wrote: > Hi, > > I'm dusting off my command-line converter tool, which is based > on plib's ssg. > > I chose to load/save ssg files *without* creating an OpenGL > context first. This used to work. It shouldn't have done. The SSG loader (like all other loaders) creates texture maps. You can't create textures without a valid OpenGL rendering context. Hence, it *shouldn't* have worked. The fact that it did would have been down to a failure of your OpenGL driver permitting operations that are illegal. So - your application was always broken, you just didn't know it. On one platform or another, it would have failed. > Now, the loading of a texture fails, because OpenGL calls > are made when loading a texture. (The PROXY_TEXTURE load). Yep. It should have failed before that because ssgInit checks for a valid rendering context. Hence either you'd disabled the check (which I disapprove of for this very reason) - or you didn't call ssgInit which is a very dangerous thing because either now or in the future, ssgInit may set up something that the loader might rely upon. > I see two solutions: > > - I cave in, and create an OpenGL window, call ssgInit, > and then do the fmt conversion. > The convertor is no longer a cmdline prog, but a full > OpenGL prog. It doesn't have to open a window to get an OpenGL rendering context. A rendering context can be a pbuffer or similar. > - ssg.cxx's IsValidContext is made available to ssgTexture.cxx > which ignores the failure of PROXY_TEXTURE generation if > there is no context. (Or better yet: mipmaps are never created > without the context). But that still ignores the fact that you are illegally skipping the call to ssgInit which may have unforseen consequences. If your program isn't already relying on uninitialised variables and pointers that are pointing to garbage - then in some future release of PLIB, it will - and it'll crash. Not calling ssgInit is utterly unacceptable. The SSG manual makes that VERY clear. > Both approaches seem ugly to me. The second approach is more than ugly - it's broken. QED. > Any advice from the list? You need to understand how non-visible OpenGL rendering contexts work. ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++ -----END GEEK CODE BLOCK----- |