is there a way you can create a torus using opengl gl and glu only…i do not want to use glut and i am trying not to…but i need to create a torus and i am not sure how to go about it…help…

There is no function in gl or glu to do that per se. But there is nothing stopping you from sweeping a partitioned circle about an axis (that lies in the plane of the circle) and creating the required mesh and drawing triangle strips.

[This message has been edited by DFrey (edited 02-16-2001).]

is there code somewhere that is good to produce a good torus?

#include <GL/gl.h>
#include <GL/glu.h>
#include <stdio.h>
#include <math.h>
#include <GL/glut.h>
#include <stdlib.h>

static void torus(int numc, int numt){
int i, j, k;
double s, t, x, y, z, twopi;

twopi = 2 * (double)M_PI;
for (i = 0; i < numc; i++) {
for (j = 0; j <= numt; j++) {
for (k = 1; k >= 0; k–) {
s = (i + k) % numc + 0.5;
t = j % numt;

        x = (1+.1*cos(s*twopi/numc))*cos(t*twopi/numt);
        y = (1+.1*cos(s*twopi/numc))*sin(t*twopi/numt);
        z = .1 * sin(s * twopi / numc);
        glVertex3f(x, y, z);


Found this in the Red Book which is located at