Jump to content
  • Advertisement
Sign in to follow this  
kgstation

Question about 2D UI in 3D scene(Direct3D9)

This topic is 2213 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 currently using ID3DXSprite interface to draw an 2D UI,like an inventory,role states etc...
But if I draw those 2D UI, my 3d scene render would be ended...
So how can I draw 2D UIs in 3D scene properly?

Share this post


Link to post
Share on other sites
Advertisement
All that ID3DXSprite does is provide a wrapper around standard vertex buffers, index buffers and draw calls so this is a problem that you're going to need to resolve anyway. The general way to handle 2D UI is to switch to an ortho projection, load identity onto view and world, disable depth test and depth write, possibly enable alpha blending, then just draw stuff. There are a coupla other alternatives, one of which would involve using an XYZRHW FVF (this avoiding the need to switch to ortho/etc), but that's really all there is to it.

Share this post


Link to post
Share on other sites

All that ID3DXSprite does is provide a wrapper around standard vertex buffers, index buffers and draw calls so this is a problem that you're going to need to resolve anyway. The general way to handle 2D UI is to switch to an ortho projection, load identity onto view and world, disable depth test and depth write, possibly enable alpha blending, then just draw stuff. There are a coupla other alternatives, one of which would involve using an XYZRHW FVF (this avoiding the need to switch to ortho/etc), but that's really all there is to it.

All that ID3DXSprite does is provide a wrapper around standard vertex buffers, index buffers and draw calls so this is a problem that you're going to need to resolve anyway. The general way to handle 2D UI is to switch to an ortho projection, load identity onto view and world, disable depth test and depth write, possibly enable alpha blending, then just draw stuff. There are a coupla other alternatives, one of which would involve using an XYZRHW FVF (this avoiding the need to switch to ortho/etc), but that's really all there is to it.

Thanks...It's working!The problem is that I released deptbuffer when I render sprite!It's fine now!

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!