MFC, multiple rendering contexts and texturing

Started by
3 comments, last by Hydrael 18 years, 1 month ago
Hello everyone, I have a little problem finding an error regarding texturing within my project. Take a look at this screenshot. This is a screenshot of my world editor. The layout is pretty straightforward: Three ortho views (top, front, left), one perspective view and in the bottom left, a preview window (which previews the currently selected static mesh with its texture). As you can see, within the perspective view, the texturing works just fine, unlike the preview view. The problem now is: I can't figure out, why texturing doesn't work for the preview window. I've checked following things: - Texturing is enabled - The rendering context for the preview window is created before I create the textures - TexCoords are all setup properly - The textures themselves are loaded and created properly I don't know where else I can look or what else I can verify. Does anyone know, what could cause texturing to work in one window, but to fail within another? Thanks a lot for any hints in advance Regards Chris
Advertisement
textures are bound per-context. I think there was an extension that allowed you to share them between contexts but don't quote me on it.
Thanks MENTAL,

I've just read, that I could use wglShareLists() to use textures over different rendering contexts. The problem is, that my viewport objects are created via RUNTIME_CLASS, and I can't access their rendering contexts (or at least, I don't know how to) at coding time.
I stumbled upon a rather elegant solution in the code for q3radiant, the Quake 3 editing tool, which I used very successfully in an MFC level editor I wrote a while ago.

Basically, it goes like this. Override the OnCreate function of your main window, and create a rendering context for it. This is now your master rendering context. Save it as a variable inside the class, or as a global variable, if you like. When your child windows are created, use wglShareLists to link them to your master rendering context. Now you can load your textures into the master rendering context, and all of your child windows can share them...
My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored.[ Useful things - Firefox | GLee | Boost | DevIL ]
Ah, now that's a great idea!

I'll give it a try, as soon as I get home.

Thanks :D

This topic is closed to new replies.

Advertisement