Jump to content
  • Advertisement
Sign in to follow this  
streamer

vertex shaders in 2D

This topic is 4543 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. I'm total noob in vertex shaders. Is there possibilitie to make 2D game using pixel and vertex shaders in c++ and directx? Any link will be great, because I'm learning from source code [smile] Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
It is possible to use them for 2D stuff, as long as you aren't using old fashioned blitting. Just use all the same stuff as you would for 3D, except just use the 2D coordinates.

Share this post


Link to post
Share on other sites
Quote:
Original post by weasalmongler
Just use all the same stuff as you would for 3D, except just use the 2D coordinates.
Just be careful of the projection matrix in this instance. If you're learning from other peoples code/examples then they'll almost always be dealing with 3D geometry which has the classic "World-View-Proj" transform thats is typically passed in as a single matrix constant.

Instead you want to pass in a float2 for the POSITION and then re-map this to -1..+1 projection/clipping coordinates for output.

Although this method can be a royal pain when it comes to directly mapping 2D images to pixels on the screen. Unless you really have to, it's probably easier to design your game so that it just outputs proportional tiles (e.g. each being 10% of the screen dimensions) and ignore the fact that they dont always match up [smile]

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!