taufique
taufique

Reputation: 2751

Drawing torus in opengl

I need to draw a torus which is very thin. What I found by searching internet is just formal description of the function glutSolidTorus() But problem is probably I am not getting what they are saying about the parameter. Every time I am trying to draw it by changing the parameters what comes out is a very fat torus.

glutSolidTorus(1.0f, 0.005f, 32, 32);

What I thought is that 1 unit is total torus radius and cross section(fat or thin determining) radius is 0.005 unit. Certainly I am wrong. Can somebody please explain me what's the problem and what to do?

Upvotes: 0

Views: 8731

Answers (1)

sir_k
sir_k

Reputation: 332

Looking at http://www.opengl.org/documentation/specs/glut/spec3/node84.html I noticed the following:

void glutSolidTorus(GLdouble innerRadius,
                    GLdouble outerRadius,
                    GLint nsides, GLint rings);

And your shape for the torus is that the inner radius is bigger that the outer radius. Try switching them around and see if that is what you want.

lutSolidTorus(0.005f, 1.00f, 32, 32);

The thickness of the torus is defined by the first parameter, innerRadius, while the second one defines how wide the torus spreads.

Edit: please visit the link in the comment bellow.

Upvotes: 3

Related Questions