Archived

This topic is now archived and is closed to further replies.

This topic is 6319 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I am new to OpenGL and I am tinkering with some of the Nehe tutorials (Which are excellent, thank you for creating them) and I am noticing that the origin seems to be the dead center of my viewport. What I would like to do is have the origin at the bottom left corner of the viewport. What kind of translation, etc do I use to achieve this? I realize this is probably a ridiculously simple thing to ask, but I am a newbie. Anyway, any help appreciated. Thanks.

Share on other sites
The simplest way is to look through the code and where it says:

  glMatrixMode(GL_PROJECTION); // Select The Projection MatrixglLoadIdentity(); // Reset The Projection Matrix

glTranslate3f( 1, 1, 0 );

This will move the camera along a bit and up a bit.....obviously change the numbers until your happy, with where the origin is.

Once you're happy doing that you ought to look at the function, gluLookAt(...) which give much better control of the camera.

dan

Game production:
Good, quick, cheap: Choose two.

Edited by - Danack on January 31, 2001 2:30:12 PM

Share on other sites
I still can''t this to work. Here is what I am doing up until the point where I want to flip the y axis direction (using Visual Basic):

glMatrixMode mmProjection '' Select The Projection Matrix
glLoadIdentity '' Reset The Projection Matrix

'' Calculate The Aspect Ratio Of The Window
glOrtho 0#, Width, Height, 0#, 0.1, 100#

'' Move Left 1.5 Units And Into The Screen 0.1
glTranslatef 0#, 0#, -0.1

Any ideas??

Marcus

Share on other sites
Hiho,
is your game meant to be 2D or 3D ??
To flip around the y-Axis you can try several solutions :

1. glRotate(180,0,1,0); This will rotate in 3D
glOrtho(0,width,height,0,-z,z) right ? change it to
glOrtho(0,width,0,height,-z,z)

Point 0 is now no longer on the bottom left but
on the top left !!!

• 23
• 10
• 19
• 15
• 14