Jump to content
  • Advertisement
Sign in to follow this  
doutmost

Question about glTranslate() ??

This topic is 5236 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

glTranslatef ( float x, float y, float z ) here, what is the measurement for x, y, z, I thought, x,y,z, they are pixels of the monitor, but it seems not. thanks for answer.

Share this post


Link to post
Share on other sites
Advertisement
No. They are units in the world.

glTranslatef(0,0,-50) will put you in the middle of the screen and 50 units back. If you don't even understand that much about OpenGL yet, maybe you should look up the red book online.

Share this post


Link to post
Share on other sites
Quote:
Original post by Vampyre_Dark
No. They are units in the world.

glTranslatef(0,0,-50) will put you in the middle of the screen and 50 units back. If you don't even understand that much about OpenGL yet, maybe you should look up the red book online.


That's pretty much it...Though if you really wanted something like you described, you could do it with glOrtho.

Share this post


Link to post
Share on other sites
it depends on the viewport how much you translate.You probably don't even see the object in the place you've translated it.
If you want to use windows coordinates try this:

glMatrixMode(GL_PROJECTION);
glOrtho(0,width,height,0,-1.0f,1.0f);
/*well..why not 0 and then height this is because for windows
the up is down ;eg.(0,0)is in the up left corner*/

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();//center the axes into the origin OF THE SCREEN
/*-1.0f,1.0f almost don't matter-you don't have depth into the screen*/


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!