please help me!

if I know a sphere equation, for example
x2+y2+z2=100, how do opengl draw this sphere?

thanks a lot!

Hi !

OpenGL can only draw triangles (and maybe quads) but that’s it, so you have to tesselate your sphere into triangles, you gan use GLU to do it for you with gluSphere, or you can do it yourself.

You can always look at the glu source code to see how it’s done (at least the Mesa version of glu) it’s at



yes, the glu source will tell you how to make a colelction of triangles make a sphere, but I think the poster is asking about how to interpret the equation of a sphere?

OpenGL cannot plot functions for you; you can’t just call some gl function to render f(x)=x^2+4, for example.

However, x^2+y^2+z^2=100 describes a sphere with radius 10, so you can just call


(or whatever the syntax for for gluSolidSPhere is; I forget).

Oh, and for anything more complex, like an ellipsoide? <chuckles politely> then you’ll need ot use scale.