abhijit

05-08-2005, 09:18 AM

Hi,

I am trying to draw text string wherever I click inside the window. To do that, I first obtain the x, y coordinates of the clicked point and use the gluUnProject with current modelview, projection and viewport setting to get the x, y and z. I set z to a fixed value say -1. I then use glRasterPos3f routine to place the label at the above x, y, z positions. However I found that there is a difference in x, y of the clicked point and the point where the label appears. I also tried to draw a point at the x, y, z and it differs from the actual clicked position. Could anyone plz explain what could be going wrong?

Thanks

-Abhijit

I am trying to draw text string wherever I click inside the window. To do that, I first obtain the x, y coordinates of the clicked point and use the gluUnProject with current modelview, projection and viewport setting to get the x, y and z. I set z to a fixed value say -1. I then use glRasterPos3f routine to place the label at the above x, y, z positions. However I found that there is a difference in x, y of the clicked point and the point where the label appears. I also tried to draw a point at the x, y, z and it differs from the actual clicked position. Could anyone plz explain what could be going wrong?

Thanks

-Abhijit