PDA

View Full Version : radius of gluSphere/gluDisk



shosking
09-04-2002, 07:04 PM
Hi,
When defining the sphere or disk, you define its radius.

However, a gluSphere or gluDisk will change dimensions (i.e., its radius will vary) according to where it is located within a viewing frustrum created by gluPerspective.

Is there any way that i can access the radius of the sphere in terms of its screen size, which changes as the object moves around in depth, other than by doing the calculations myself using the perspective matrix generated by gluPerspective.

That is, can i write some code that accesses the radius of the sphere, and returns it to stdout.

thanks,
Simon

rIO
09-05-2002, 01:22 AM
No, you can't, just do the math by yourself.

nexusone
09-05-2002, 04:32 PM
First remember that you are viewing an object in 3D, of course as a object moves away it will apear smaller. But the radius in not changing, just the distance from you.


If you do not want a perspective world view, change to ortho mode. Object size does not change as it moves away from you on the screen.

If this does not help, give a little more detail as to what you are trying to do. When then maybe can give you clear answer.


Originally posted by shosking:
Hi,
When defining the sphere or disk, you define its radius.

However, a gluSphere or gluDisk will change dimensions (i.e., its radius will vary) according to where it is located within a viewing frustrum created by gluPerspective.

Is there any way that i can access the radius of the sphere in terms of its screen size, which changes as the object moves around in depth, other than by doing the calculations myself using the perspective matrix generated by gluPerspective.

That is, can i write some code that accesses the radius of the sphere, and returns it to stdout.

thanks,
Simon