Jump to content
  • Advertisement
Sign in to follow this  
RavNaz

2D Vertex Shader?

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

Hi again guys, anyone know what the correct vertex shader would be if you didn't want the poly to be projected. At the moment I use the same vertex shader, which multiplies the incoming vertex info by the World Proj Matrix. If I just wanted to display something 2D using the vertex shader how would I do this? [edit] I'm using HLSL btw, not ASM

Share this post


Link to post
Share on other sites
Advertisement
you only need to remove the multiplication. just return the vertices from the vertex shader as they come in.
then your screen goes from (-1,-1) to (1,1).

Share this post


Link to post
Share on other sites
Wel the vertices that are coming in, if they are pretransformed should be described on a pixel grid, specifying the actual pixels they lie on. Given the width and height of the back buffer in the shader you would have to convert the actualy coordinates to lie within the -1 - 1.

Wouldn't you?

Dave

Share this post


Link to post
Share on other sites
You can just use an orthographic projection matrix instead of a projective one in which case you'll have to do nothing special in your vertex shader.

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!