Jump to content
  • Advertisement
Sign in to follow this  
Universe Stick

glOrtho

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

I am trying to make a 2D game based of pixels an I heard glOrtho is the way to go. I don't know how to set it up, though. Can someone paste some example code on how to set it up? Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
Setting OpenGL to project orthogonally (objects stay the same size regardless of distance from the camera) is easy.

glOrtho(left_coor_boundary, right_coor_boundary,
bottom_coor_boundary, top_coor_boundary, near_clip, far_clip);

You need to determine the values yourself based on what you want to do.

However, trying to set up the screen itself depends entirely on your operating system or if you're using another library, like SDL or Allegro, to deal with the window creation for you. You can find a good tutorial for setting up an OpenGL window using straight windows code in the NeHe tutorial section, or with SDL at lazyfoo's site.

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!