Jump to content
  • Advertisement


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

Question about the origin

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

If you intended to correct an error in the post then please contact us.

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

Link to post
Share on other sites
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.


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
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??


Share this post

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

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!