   Dynamic textures - best place to update?
  Hi,I've been wondering what the best place would be to update dynamic textures (reflection of water + shadow map). Currently I have them in my BeginScene()/EndScene() block, which sounds like an awfully bad place to lock something.I think I read somewhere that stuff like that should be before BeginScene(). Any opinions on this?Next to that, I wonder if a simple 'switching' texture would be better to render to. so, like a backbuffer. The game would always render from a texture which was not updated that frame, next frame, the textures will be switched again, etc.Any opinions? Just wondering! :)   
  Well, from my limited understanding, you MUST update the texture between the begin/end scenes.  From the SDK:Quote:From the DirectX 9 SDKApplications must call BeginScene before performing any rendering and must call EndScene when rendering is complete and before calling BeginScene again.I suppose it depends on what you mean by update.  If you are moving geometry around and recalculating what the render-to-texture is seeing, then it would probably be better to have it close to the beginning of the frame to give it some time to get calculated before you have to actually render to the texture.The idea of pre-rendering the render-to-texture a frame in advance to save the lock/unlock from being in the begin/end scene pair does sound like a good idea.  I haven't really done this, but it would be interesting to profile some tests to see which is faster, and by how much.   ;Quote:Original post by MoeWell, from my limited understanding, you MUST update the texture between the begin/end scenes.  From the SDK:Quote:From the DirectX 9 SDKApplications must call BeginScene before performing any rendering and must call EndScene when rendering is complete and before calling BeginScene again.I suppose it depends on what you mean by update.  If you are moving geometry around and recalculating what the render-to-texture is seeing, then it would probably be better to have it close to the beginning of the frame to give it some time to get calculated before you have to actually render to the texture.The idea of pre-rendering the render-to-texture a frame in advance to save the lock/unlock from being in the begin/end scene pair does sound like a good idea.  I haven't really done this, but it would be interesting to profile some tests to see which is faster, and by how much.Well, you can call BeginScene/Endscene as much as you want. I'm just not sure if it creates a lot more additional overhead.With updating I just mean like rendering my terrain's reflection to a texture. - Or the depthmap of the shadows. :)   