Render Context Switches and extensions

Started by
-1 comments, last by Wicked Ewok 18 years, 8 months ago
Hi there, I have recently finished a thumbnail shell extension for windows that automatically displays thumbnails of model files in explorer when you set the folder display options to view thumbnails. First off, for anyone interested in writing that sort of program with an OpenGL engine, you'll be dealing with a lot of thread crap,. Particularly, if you would like to initialize the engine just once during your shell extension's DLL Load, you have to realize that calls to Extract() might originate from a different thread which means the rendercontext you loaded up with might not be valid in that thread. Calling the engine with that thread will fail. There are a few solutions but the best one I've found is to create a generation thread during start up. For every Extract() call, post a message to that thread and wait for the thread to reply back with the generated HBITMAP handle. Sure beats initializing/deinitializing the engine in Extract every time you generate a thumbnail for a file. That said, I've run across a problem that I think has to do with render context switches. I have an MDI application which uses my shell extension to generate thumbnails in a child window in the app. Now as a little test to see if my shell extension was stable, I loaded a level for the engine in another child window of that same application. At this point, I'm generating thumbnails and looking at the level except I get GLErrors on glSetInvariantEXT() and only that function. The GL Error is "Invalid Operation". Once the thumbnail generator has finished rendering, it sits there for a while(I need to unload it manually I think). But the error continues in the main rendernig window display the Level I loaded. I'm sort of clueless as to why this would be. I have seen this issue with the GL Error for glSetInvariantEXT crop up before when I used pbuffers, and you usually get "Invalid Operation" errors when you're rendering to an invalid context, or the resource you're rendering doesn't exist in and is not shared(wglShareLists) with the context. But it's funny that only one function, glSetInvariantEXT, gets the invalid operation when I'm rendering with these two contexts (in different threads using two different instances of the engine btw). Otherwise the level looks fine, the thumbnails also look fine. And why when I then stop rendering using the thumbnail generator, I still get this error in the main Level's rendering loop. There's no other rendering besides the main loop at this point. The thumbnail generator is waiting for new messages it can process, which it never receives because it has finished browsing for files. If anyone has any insight or idea about what's going on and how I might be able to fix this please tell me. Thanks! -Marv
-=~''^''~=-.,_Wicked_,.-=~''^''~=-

This topic is closed to new replies.

Advertisement