View Full Version : A little problem with gluUnproject..

12-14-2002, 02:02 AM
What's bad with this code?

gluUnProject(u, view[3]-i, 0.0, (double*)w3d->mm, (double*)w3d->pm,
(GLint*)view, &r[0], &r[1], &r[2]);

gluUnProject(u, view[3]-i, 1.0, (double*)w3d->mm, (double*)w3d->pm,
(GLint*)view, &r[3], &r[4], &r[5]);

I'll say to you, what's bad with this code.

With a small world, everythng is fine, but.
When I translate for more than 20.0 units from the origin, the ray resulting from the deceptive gluUnProject, doesn't give to me the result I duly deserve.

Let me explain.
I have this world, with some spheres (it's a game, ok), and you can click on said spheres, but. if you click on a sphere that's too far from the origin.
Ahh, forgething, a.

OK my problem, to be clear, is that I coded a small raycaster to fully investigate my problem, and it seems that the spheres are smaller, when gluUnProject is used, than when they are drawn with gluSphere.

Any suggestion? I searched on google, but found nothing related to some offset problem with gluUnproject.
Im using only GLdouble and I am a bit tired.