Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So in my SDL application, which I setup for OpenGL, if I were to do the following code:

glVertex2i(0, 0);
glVertex2i(50, 0);
glVertex2i(50, 50);
glVertex2i(0, 50);

The quad shows up on my right hand side of my screen. I tried to use glOrtho but that didn't work for some reason. What happend?

share|improve this question
I would guess it's because the OpenGL co-ordinate system is far from intuitive. – Polar Jun 2 '13 at 7:52
You should accept answers, if they're correct :L – CoffeeandCode Jul 31 '13 at 10:44

The problem seems to be because you are treating (0, 0) as the bottom left; in OpenGL (0, 0) is the center of the screen.

To say this is counter-intuitive is silly, it is fully your opinion to say so.

I presume you have a 50x50 window you are trying to fill?

To get your desired behaviour you would need the following:

glVertex2i(-1, -1); // bottom left
glVertex2i( 1, -1); // bottom right
glVertex2i( 1,  1); // top right
glVertex2i(-1,  1); // top left

and a diagram

(-1, 1)--------------------------(1, 1)




(-1,-1)------------------------(1, -1)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.