Sign in to follow this  
Hydrael

MFC, multiple rendering contexts and texturing

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this