radius of gluSphere/gluDisk


i’ve also posted this on the beginner’s forum, but not sure if it is an advanced question or not.

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 an opengl function that determines the radius of the sphere at position xyz, and returns it to stdout.


This becomes a more complex problem when one realizes that after being projected, a sphere is not nessecarily a sphere anymore.

You probably want the radius parallel to the x or y screen axises.

Its too late for me to come up with a solution. There have been a couple of posts this week which ask a similar question. They want to figure out the rectangle which will bound a sphere after projection so they can set up the scissor box to clip shadow volumes.

yes, Nakaruru, i want the radius parallel to the x or y axis, not the z.