PDA

View Full Version : Render a trimmed sphere ? (a quarter of sphere)



HaVyThoai
11-07-2007, 10:59 AM
Hi everybody!

As you know, in the GLU Library to render a complete sphere we use the command below

void gluSphere(GLUQuadricObj *obj, GLdouble radius, GLint slices, GLint stacks);

But I want to render a trimmed piece of sphere, such as a quarter of sphere. What do I have to do?.

a more thing that, I want to render a sphere drawn with triangle strips, not quad strips like the above command. How do I have to do ?

Please, help me. Thank you very much :eek:

Trenki
11-07-2007, 12:05 PM
One way I could think of is setting user clip planes and then drawing the sphere with the above method.

But you say you want triangle strips. There is no way around writing your own function to do that. You have to calculate the correct vertex coordinates on the sphere and connect the correct vertices to form triangles.

[ www.trenki.net (http://www.trenki.net) | vector_math (3d math library) (http://www.trenki.net/content/view/16/36/) | software renderer (http://www.trenki.net/content/view/18/38/) ]