Get Viewport coords of a point

Started by
0 comments, last by V-man 15 years, 7 months ago
How can I determine an object's location in my current viewport? (my viewport does not take up the entire screen) I know the location of the object and my camera position.
Advertisement
gluProject will compute the screen space coordinates for you.
Souce code for GLU is at mesa3d.org
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement