Jump to content
  • Advertisement


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


gluProject problem

This topic is 6068 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m using gluProject to get the screen(or off-screen) value of an object. I then use this to put an indicator on the screen where the object is or on the edge of the screen where the object is closest to. The problem is, is that if I''m turned 180 degrees or thereabouts, looking away from the object, there''s a phantom indicator showing up there. As near as I can tell gluProject is the problem. Any suggestions?

Share this post

Link to post
Share on other sites
What do you mean by the ''screen value''? gluProject is used to get where a point in 3d-space will appear in the screen in pixels, with the z value being what you would find in the z-buffer. It can also fail, i.e., if the point is behind you, and will tell you by returning GL_FALSE, aka, zero.

If it doesn''t work, make sure that you loaded the correct data into modelMatrix, projMatrix, and viewport. And you need to reload the modelMatrix every frame if you are changing you''re view, and the projMatrix if you have something like a zooming sniper scope, and the viewport if you resize the screen.

The phantom indicator, is probably due to you not checking for an error, as when something is behind you, it gets turned upside down infront of you, as they are the FOV over the distance from the camera or something, and clipping keeps away the evil division by 0 error, and keeps the things behind you from appearing infront of you only upside down like.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!