• Advertisement

Archived

This topic is now archived and is closed to further replies.

How to create a sphere?

This topic is 5601 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How to create a sphere (without using gluSphere() function) using triangles or quads?

Share this post


Link to post
Share on other sites
Advertisement
Red Book page 88,

Links to code from red book ftp://sgigate.sgi.com/pub/opengl/opengl12.zip

or try sgi.com and search for code.


Or another method would be to draw circle at different angles

Here some code off my head.


z = 0;

glBegin(GL_TRIANGLES);
for (radian = 0; radian > PI*2; radian = radian + PI /180){

x = sin(radian) * centerx;
y = cos(radian) * centerY;
glVertex3fv( x, y, z);


}
glEnd();


use glRotate after each circle to rotate and at Z angle.

I would stick to the red book if I was you.

[edited by - jlebrech on October 21, 2002 2:24:54 PM]

Share this post


Link to post
Share on other sites

  • Advertisement