Update textures using SetRenderTarget

Started by
0 comments, last by djalexd 18 years, 1 month ago
I'm working on the terrain rendering technique which involves displacement mapping. I have a couple of textures that are, logically, the mip-map of the terrain. Now, I have to update them all, from the biggest to the smallest, and to do so I do the following: device->GetRenderTarget(0, &oldRT); device->GetDepthStencilSurface(&oldDSS); device->BeginScene(); for (i = 0; i < levels - 1; i++) { // // Set the current texture as displacement map device->SetTexture(D3DVERTEXSAMPLER0, level.displacement); // // Set the next texture as render target and the depth surface as NULL device->SetRenderTarget(0, level.displacement); device-&gt;SetDepthStencilSurface(NULL); // // Render a 2D quad that updates the texture (no Clear) } device-&gt;EndScene(); device-&gt;SetRenderTarget(0, oldRT); device-&gt;SetDepthStencilSurface(oldDSS); This is achieved in the Update function that is called before Render function. However, when I move through the world (so the Update is called), the terrain disappears until I stop moving; then the terrain appears again, like nothing had happened. I don't know why this happens, can anyone help me? My updating textures are 32bit floating point if this is of any importance.
Advertisement
I've moved that code before the rendering, so now I only have one BeginScene / EndScene, but I still encounter that problem. Can anybody help me?

This topic is closed to new replies.

Advertisement