Rendering with Direct3D
Posted
by
Jamie
on Game Development
See other posts from Game Development
or by Jamie
Published on 2011-01-13T06:02:27Z
Indexed on
2011/01/13
6:58 UTC
Read the original article
Hit count: 583
Hi,
I'm slightly confused about how Direct3D rendering works. Basically, as long as I render to one surface, everything is fine. But when I try rendering to multiple surfaces, it seems like everything is still rendered to one surface. I think there's something wrong with my calls.
For each update cycle this is what I do 1. device->BeginScene() 2. sprite->Begin(...)
... A bunch of GetRenderTarget to store the old render target, then SetRenderTarget to set a new surface, and then things like CreateVertexBuffer, SetTexture, etc to draw on the new render target. Then resetting to the old render target.
- sprite->Draw([the back buffer]) (the back buffer is actually another surface, not the actual back buffer. But here it is being drawn onto the actual back buffer, I think)
- sprite->End()
- device->EndScene()
- device->Present(...)
Also, it seems like if I mix sprite drawing and non-sprite drawing onto a surface, that first one set of render commands is executed and then the other set, rather than in order by when each command was called.
If anyone could shed light on any of this, it would be much appreciated.
© Game Development or respective owner