PDA

View Full Version : Shared cubemap texobj issue



MikeCarter
09-14-2005, 11:20 AM
Here's a puzzler that I'm hoping someone else has seen. It involves shared cube map texture objects. Here's what happens: I have an existing GLRC in a window, displaying a model mapped with a cube environment map. It renders just fine to this point. Then I create a pbuffer GLRC, call wglShareLists() (which reports success) against the original GLRC, and render the same model using the now-shared cube map texture object. The texture is dropped, and does not render.

This behavior happens across driver versions, across vendors (both ATI & nVIDIA), and across applications. If I sabotage the code that calls wglShareLists() and keep separate texture objects for the pbuffer context, then it renders just fine.

All other shared OGL state is happy. Display lists, shader objects, and all other types of texture objects are properly shared and rendered. It is only cube map texture objects that are affected. I have also tried packing all six faces into the same texobj, and splitting the six faces into six separate texobjs, all with the same result.

Does anyone have any experience or suggestions with this sort of thing?

Hlz
09-16-2005, 05:50 PM
Can you post/link a test case?

Hlz

ChiefWiggum
09-16-2005, 10:59 PM
Well this isnt what you want to hear, but it works for me. I'm able to draw the same scene turning pbuffers on and off (obviously either draw to frame buffer, or to pbuffer texture and then draw that to the frame buffer as a quad).

I do recall having some issues with it at the start though. Heres my pbuffer initialization sequence, hope it helps

wglChoosePixelFormat
wglCreatePbufferARB
wglCreateContext
wglShareLists (with the onscreen & pbuffer RCs)
THEN I create the pbuffer's texture object

It took me a while to get all my pbuffer code working, but havent touched it in like 6 months, so I hope this helps you!

MikeCarter
09-19-2005, 03:35 AM
I'd love to be able to post a simple test case, but this coding in running in the context of a much larger toolkit (DirectModel), and I haven't taken the time to extract a standalone example. It is good to know that someone else has successfully done this, though.

A followup to Chief: I have my texture objects created on the main GLRC before creating and sharing out the pbuffer (or secondary window) GLRC, so there's one difference. Here's a question as well: do you package all six cube map faces into a single texture object, or place one cube face image into each of six separate texture objects? I've tried it both ways with the same result, but thought I'd ask since it is not completely clear either in the red book or the spec as to how this is supposed to work.

I will try forcing all my texture objects to be rebuilt, and see if that has any effect.

MikeCarter
09-23-2005, 06:21 AM
OK, my bad. My problem was that I was calling glBindTexture(GL_TEXTURE_2D, *) instead of CUBE_MAP. Too many software layers. Thanks to those who replied to me.