View Full Version : Origin at the center.. how ?

10-19-2011, 03:29 PM
Hello (...);
I've just started learning OpenGL.

I have done a few programs and everything seems to be working fine.

Till now, I've ignored the initializing part of the code, focusing on the drawing part.
Now, I want to set it up such the origin is at the center, of the window.
Is that set from the following lines? :

glMatrixMode ( GL_PROJECTION );
gluOrtho2D ( 0.0, (GLdouble)320, 0.0, (GLdouble)240 );

or tool specific (In that case, I'm using sfml...and would post some more code) ?

10-19-2011, 03:39 PM
Problem solved, with an advice that I change the 3rd line to
gluOrtho2D(-640/2.0, 640/2.0, -480/2.0, 480/2.0);
....my window dimensions being 640 and 480 now.