VertexCorridinates
Hi!
I have here a little problem with glVertex3f. I wanna to make a box, which should represent the console.
But i am a confused with the norms of the glVertex** command.
If i:
glLoadIdentity();
Where is the orgin. Where on the Screen is (1.0f, 1.0f, 0.0f)?
Can i make a conversation from Pixels to the float Value?
Like the actuall windowdimensions are 800 * 600 and then (1.0f, 1.0f, 0.0f) is the right button corner?
Thanks Christian
Well, It''s up to how you define your viewport and viewing frustrum.
Note that in OpenGL, things are not in the way that I would say "Grand Coordinates", since OpenGL is a state machine. There''s no way you can tell the origin when series of transform is done, unless you keep a really good track of it. I mean, the origin will always be at 0.0,0.0,0.0. But think about if you use something like.. glTranslatef(..). The origin will move somewhere from where it was, it will always be 0,0,0. But at different place. The way I think of OpenGL is like I have a digital 3D pen, which I can move it around and draw stuff. If this sound confuse, you can read the redbook.. they have one good chapter about transformation.
Anyway, if the only thing you need to do is to draw the console. Then,
1) Draw your 3d stuff first
2) set the viewing frustrum to be Orthographic projection, with the hieght and width that matches window size.
Then the pixels values defined by glVertex2i(..) will match what is on screen. So no conversion is needed.
Note that in OpenGL, things are not in the way that I would say "Grand Coordinates", since OpenGL is a state machine. There''s no way you can tell the origin when series of transform is done, unless you keep a really good track of it. I mean, the origin will always be at 0.0,0.0,0.0. But think about if you use something like.. glTranslatef(..). The origin will move somewhere from where it was, it will always be 0,0,0. But at different place. The way I think of OpenGL is like I have a digital 3D pen, which I can move it around and draw stuff. If this sound confuse, you can read the redbook.. they have one good chapter about transformation.
Anyway, if the only thing you need to do is to draw the console. Then,
1) Draw your 3d stuff first
2) set the viewing frustrum to be Orthographic projection, with the hieght and width that matches window size.
Then the pixels values defined by glVertex2i(..) will match what is on screen. So no conversion is needed.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement