This is a long running quest to get dynamic reflections working through pbuffers. I’ve had various bugs crop up over the last 2 years, first on 9800’s then on my current 6800. This one I simply havent been able to solve, and havent found anyone doing the same thing on the forums, google.
I’m drawing to a pbuffer cubemap, and drawing that by binding it to a texture. There are no errors in creating the pbuffer, and its infact the same pbuffer class I use successfully for all other RTT including post processing.
When I draw to the cubemap, only the X+ face actually works. This will be 100% clear, no corruption at any resolution. The other faces generally show glClearColor on them, but sometimes will show garbage:
,
(They are multicoloured because I clear each face to a different colour for testing! If I redraw a 2nd time, only the clearcolour is shown on faces except X+ which works)
It should look like:
(the stuff in the Y-,Z- faces isnt garbage! And yes I know they dont line up properly )
To switch faces I call wglSetPbufferAttribARB(m_hPBuffer, face) where face is one of the WGL_ cube face defines. No errors here either.
I’ve tried drawing all faces at once (make pbuffer current, draw each face, make FB current & use as texture), I’ve tried updating one face at a time (make pbuffer current, draw current face, make FB current & use as texture).
I also allow my program to save TGA’s of cubemaps so they can be used as static reflections. This has the same output as described, I get the image back with glReadPixels once it has been drawn.
I’ve tried calling glFlush after each face is drawn, or once after all faces are drawn. Tried glFinish too.
I thought its hopeless but just 10 minutes ago I realised if I resize the cubemap to 2x2, 4x4, 8x8 or 16x16 it WORKS! No corruption at all. If I go above 16x16 its very strange - the first draw into the newly recreated pbuffer has most faces drawing (some with garbage), the 2nd draw ONLY the X+ face draws.
I’ve also tried changing the update interval - once very frame, every 2, every 5, 10 frames…
Surely someone else has implemented this successfully, I’d love to hear they found a similar problem and solution
I’m using a 6800GT, 81.94 drivers, windows xp SP2
Thanks for any help!
Edit: Depth and stencil buffers are cleared before each face is drawn (with the colour clear, and the colour clear clearly works!). I first thought it could be depth or stencil problems but at 16x16 it works fine!
Edit 2: I havent even found a demo on the net using pbuffer cubemap RTT! Maybe this is why…?