Sign in to follow this  
RavNaz

2D Vertex Shader?

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this