Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

billybob

drawing in camera space without transforming?

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

how would i go about making a hud, or draw numbers on the screen without getting them transformed? for right now, i want to draw the fps in the top left corner. i can make a texure thats really long and high enough to hold one number, is it possible to just blit source rectangles from this texture onto the screen without going through the transformations? i.e. give it 2d resolution coords instead of 3D transformation coords?

Share this post


Link to post
Share on other sites
Advertisement
Pre-transformed objectes is what you want. In order to do it in the fixed function pipeline, you need to add an rhw member to your vertex structure and set it to 1 usually. Pretransformed objects don''t get affected by the transformation matrices. Another option is a vertex shader that just passes the vertex along the pipeline. Finally, you could set all three matrices to the identity matrix before rendering the hud. The vertices for pre-transformed objects are in screen coords, although you should subtract 0.5 from the coords to get 100% accuracy.

---
My Site
Come join us on IRC in #directxdev @ irc.afternet.org

Share this post


Link to post
Share on other sites
quote:
Original post by RapidStunna
Pre-transformed objectes is what you want. In order to do it in the fixed function pipeline, you need to add an rhw member to your vertex structure and set it to 1 usually. Pretransformed objects don''t get affected by the transformation matrices. Another option is a vertex shader that just passes the vertex along the pipeline. Finally, you could set all three matrices to the identity matrix before rendering the hud. The vertices for pre-transformed objects are in screen coords, although you should subtract 0.5 from the coords to get 100% accuracy.

---
My Site
Come join us on IRC in #directxdev @ irc.afternet.org

is there an example how to do this somewhere?

Share this post


Link to post
Share on other sites
Use the D3DFVF_XYZRHW flag in your FVF. Then in your vertex declaration use

FLOAT x,y,z,w;

If you set the w value to 1.0f, then you have the range -1 to 1 for x and y, and 0 to 1 for z. -1 for x is the left of the screen, -1 for y is the bottom. 0 is near-clip for the z, and 1 is far clip.

Rory.

Share this post


Link to post
Share on other sites
Always wondered, is there a w value you can set so that xy coords come out unchanged - (5,7) is drawn to (5,7) on the screen? Or is that not possible?



Read about my game, project #1



John 3:16

Share this post


Link to post
Share on other sites
Not sure about using a w coordinate, but using D3DFVF_XYZ with an orthogonal projection matrix you should be able to map to screen coords.

[edited by - Grambo on July 29, 2002 5:04:27 AM]

Share this post


Link to post
Share on other sites
Basically, all the coordinates get divided by the w coordinate before they are rendered. This means that the point (1.0, 1.0, 1.0, 1.0) is the exact same point as (2.0, 2.0, 2.0, 2.0). So you can''t get an exact mapping from your screen width to your vertex coordinates unless you are using a square display!

Rory.

Share this post


Link to post
Share on other sites

  • 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!