Archived

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

MarcusLM

Question about the origin

Recommended Posts

MarcusLM    152
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 this post


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

    
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix

glLoadIdentity(); // Reset The Projection Matrix



add just underneath:

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 this post


Link to post
Share on other sites
MarcusLM    152
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 this post


Link to post
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
2. your are using :
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 !!!

Share this post


Link to post
Share on other sites