gluProject()

hi all,

here is my pb:

i’m using the gluProject method in order to retreive the screen coordinate of an object in my 3D scene.

I move the camera into the scene and for each event about camera moving i retreive the coordinates which are positive values if the object is in front of the camera but when it’s not, the coordinates pass to negative value. The pb is when my camera moves away from the object, the negative values pass to positive value and i’d like to avoid the cycle negative to positive.

Do you understand what i mean? I know it’s quite difficult to explain my pb but if anybody can help me do it please!!

thx

If your object is behind the camera, that means it’s not on the screen. How do you want to calculate screen coordinates for something that isn’t on the screen if not by using negative values?

– Tom

Originally posted by Tom Nuydens:
[b]If your object is behind the camera, that means it’s not on the screen. How do you want to calculate screen coordinates for something that isn’t on the screen if not by using negative values?

– Tom[/b]

yeah i need to calculate object behind the camera that means indeed the object is not on the screen that’s why i get negative values but if i move away from the object suddenly, coordinates are positive why???

I know what you mean, the objects will appear on screen and move away from the viewer as the object moves further behind the near plane.
Tom’s right, this is why OpenGL does clipping. So you should manually clip your triangles to the near plane prior to projection.