Archived

This topic is now archived and is closed to further replies.

crippl0r

gluProject help

Recommended Posts

Hi everyone, I''m hitting a snag with gluProject. Here''s my code (it''s brief):
glGetDoublev( GL_MODELVIEW_MATRIX, modelview );
glGetDoublev( GL_PROJECTION_MATRIX, projection );
glGetIntegerv( GL_VIEWPORT, viewport );

gluProject(10.0, 10.0, 3.0, modelview, projection, viewport, &x1, &y1, &z1);

printf("screen coords = %d %d %d \n",x1,y1,z1);
 
I''m assuming that gluProject takes the 1st three coordinates, transforms them using the modelview, projection, and viewport, and places the new screen coords in x1 y1 and z1. However when I print out the screen coords I get values like this: screen coords = -1819852302 1081448324 798334230 screen coords = 1775872036 1081645527 -9950101 Am I forgetting to do something? By the way if it matters my window width and height are both 512, and I''m standing at world coordinates 0, 0, 2 and looking at 1, 1, 2.

Share this post


Link to post
Share on other sites