Sign in to follow this  
Universe Stick

glOrtho

Recommended Posts

Universe Stick    100
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
zerothrillz    152
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

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