Jump to content
  • Advertisement
Sign in to follow this  
djalexd

Update textures using SetRenderTarget

This topic is 4485 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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[i + 1].displacement); device->SetDepthStencilSurface(NULL); // // Render a 2D quad that updates the texture (no Clear) } device->EndScene(); device->SetRenderTarget(0, oldRT); device->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.

Share this post


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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!