Two gluProject points? - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Two gluProject points? (/thread-9670.html)
Two gluProject points? - mikey - Jan 2, 2012 11:58 AM
I have been using gluProject in my 3D scene with the following code:
The problem is that the label 'Marker' is being drawn twice, once where it is supposed to be at (3D Object) and then again when the user is facing away from the object, but in the right position. That is, when I face the real marker, then turn exactly 180 degrees around there is another fake marker.
I think this may have something to do with a Z coordinate from gluProject, but I tried only drawing the marker when label_position_z was less than 0 and then only when more than 0; no results, still two markers.
Any help is greatly appreciated,
RE: Two gluProject points? - OneSadCookie - Jan 2, 2012 12:39 PM
z_position is a window z coordinate. How are you getting it?
RE: Two gluProject points? - mikey - Jan 2, 2012 01:23 PM
What do you mean? I am inputting the x_position, y_position and z_position as geographical locations in my world.
Quote:GLint gluProject( GLdouble objX,- OpenGL Wiki
RE: Two gluProject points? - OneSadCookie - Jan 3, 2012 12:41 AM
oh yeah, sorry, I'm backward, despite having worried that I might be backward :/
How are you drawing the marker at the calculated window coords?
RE: Two gluProject points? - mikey - Jan 3, 2012 11:20 AM
Here's the function call in the previous code:
I am also drawing a circle at the same position (label_position_x,label_position_y). This behaves with the text.
RE: Two gluProject points? - mikey - Jan 5, 2012 01:03 PM
The label_x and label_y coordinates are definetly right, I think that somewhere a Z coordinate is being neglected, but I can't find any appropriate... n.b. label_position_z is always 1.0, is this correct?