Question about glTranslate() ??
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.
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.
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.
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.
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:
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*/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement