Jump to content
  • Advertisement
Sign in to follow this  
roby65

GUI Drawing

This topic is 3937 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

Hello guys! I'm making a GUI in my 3d engine using directx, how can i draw gui?? i was thinking about using sprites, but is there a way to stretch them???(or to stretch a texture?? Thanks... :)

Share this post


Link to post
Share on other sites
Advertisement
Yes, you can use D3DX Sprites for this job - but you should appreciate that they are a quick and simple approach and you may quickly find that they don't cater for all your requirements.

The more traditional (and more complex) approach is to use pre-transformed and pre-lit geometry (D3DFVF_XYZRHW or POSITIONT declarations) where you can specify pixel coordinates for your UI elements.

By virtue of going with screens-space coordinates you start to tie your geometry to a particular resolution. A more robust way is to design relative coordinates in projection space (-1..+1) which not only gives you resolution independence but also re-enables the transform stage in the pipeline.

Texture scaling is handled the same as normal rendering, so no worries there. You may need to be clever to handle the 3x3 grid approach if you don't want distortion.

hth
Jack

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!