Jump to content

  • Log In with Google      Sign In   
  • Create Account


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 kgs   Members   -  Reputation: 203

Like
0Likes
Like

Posted 24 July 2012 - 01:32 AM

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?
My english is very poor!

Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 6367

Like
1Likes
Like

Posted 24 July 2012 - 03:04 AM

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.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#3 kgs   Members   -  Reputation: 203

Like
0Likes
Like

Posted 24 July 2012 - 09:35 AM

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!
My english is very poor!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS