PDA

View Full Version : World coordinates to screen coordinates



iris_raj
02-19-2007, 05:34 AM
Dear All,

I want to exact screen coordinate for a given world coordinate. When you click on the viewport using glutMouseFunc you will get the screen coordinate. But I want to write my own code for the generating the screen coordinates for a given world coordinates instead of using glutMouseFunc(). How to do that.

void worldToscreenCoordinate(worldx, worldy,worldy)
{


}

RAJESH.R

Overmind
02-19-2007, 06:35 AM
Have a look at gluProject.

The window coordinates you will get are with the origin in the bottom left corner, but the mouse coordinates have the origin in the top left corner, so you still have to invert your y coordinate.