How do I set it up so that I can send viewport coordinates (between 0,0 and 640,480, for example) directly to OpenGL? I know you have to set the modelview and projection matrices to identity, but I don’t quite understand what else I need to do. Something with homogenous coordinates? Any help would be appreciated.
Once the matrices are set to identity, the only thing you have to is :
- Calculate your own transformation Matrices
- Use the glMultMatrix(not sure about the syntax) so the that your matrices are used.
You don’t have to use glMultMatrix if you transform your vertices manually.
If you really want to send coordinates as screen space coordinates use the following:
glOrtho(0.0f, 0.0f, 640.0f, 480.0f, -1.0f, 1.0f);
glViewport(0.0f, 0.0f, 640.0f, 480.0f);
glOrtho(0.0f, 640.0f, 0.0f, 480.0f, -1.0f, 1.0f);
Oups sorry. I didn’t read the message correctly!