Hey, I'm trying to make my engine support 2D rendering with Direct3D.
I can do that with:
D3DXMatrixOrthoOffCenterLH(&m_MatP2D, 0.0f,1.0f,0.0f,1.0f,0.0f,1.0f);
http://msdn.microsof...7(v=vs.85).aspx
Now, I would like depth buffering enabled for 2D. But I don't want it to interfere with the 3D graphics
(2D should always render "on top of" the 3D graphics)
What can I do to achieve that?
Drawing 2D with Direct3D: depth buffering?
Started by Xcrypt, Feb 21 2012 04:06 PM
2 replies to this topic
#1
Posted 21 February 2012 - 04:06 PM
#2
Posted 21 February 2012 - 05:14 PM
Render the 3D graphics, then clear the depth buffer, and render the 2D graphics.
reedbeta.com - developer blog, OpenGL demos, and other projects
#3
Posted 21 February 2012 - 07:27 PM
You could save on some fillrate by reusing the depth buffer if you deal with opaque overlaps, but quite often I use transparency where I have to use a painters algorithm anyway. In this case I just disable depth reads/writes. Teh google found me this (see DepthEnable / DepthWriteMask).
http://www.nutty.ca - Being a nut has its advantages.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












