RTT on GF4 41.09

I’m copying nvidia’s example simple_shadow_map_render_depth_texture.

My code boils is similar to their render_light_depth function:

if (wglMakeCurrent( pbuffer.hdc, pbuffer.hglrc) == FALSE)
if (wglMakeCurrent( hdc, hglrc) == FALSE)

When I render from the light’s point of view the only things I enable are depth, culling, and colour material.

One thing I notice is that setting and unsetting my pbuffer context is no problem. But when I set it, render the scene (just one model of it actually) to it, and then restore the main context, I sometimes get wierd artefacts depending on the view. Sometimes I have the wrong texture or no texture on certain parts of certain models! I can clear the buffer (depth and colour), but I can’t draw to it without causing corruption elsewhere!

I’m not trying to use this pbuffer for anything yet, I’m simply trying to render to it.

Anybody else encounter anything like this?

(a) Where are the corruptions occurring, in the pbuffer or the main window? (Presumably in the main window given you mentioned missing textures)

(b) A link to a screen shot is always helpful.

These are happening in the main window. Sometimes it simply causes the wrong texture to be used.