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?

  • 1
    \$\begingroup\$ I would guess it's because the OpenGL co-ordinate system is far from intuitive. \$\endgroup\$
    – Polar
    Commented Jun 2, 2013 at 7:52

1 Answer 1


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)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .