View Full Version : Trying to create a glu Cylinder

Sythe Dragon
01-21-2010, 09:46 AM
Hello first time poster here with a problem with gluCylinder and gluNewQuadric.

I'm attempting to create a cylinder to act as a wheel for my cannon, however i'm so far unsure as to how to create a new quadric. This is how i've attempted it so far (and have been met with a humongus ammount of compiler errors!)

void wheel()
void gluQuadricNormals(GLUquadric *wheel1, GLenum GL_SMOOTH)
gluCylinder(wheel1, 1.0, 1.0, 0.4, 1, 16);

Thank you

Sythe Dragon
01-21-2010, 09:48 AM
oh and sorry i'm aware that the
gluQuadricNormals(GLUquadric *wheel1, GLenum GL_SMOOTH)
is missing a semicolon.

01-21-2010, 06:40 PM
You may get some benefits from
Redbook examples (http://www.opengl.org/resources/code/samples/redbook/). Especially the example quadric.c (http://www.opengl.org/resources/code/samples/redbook/quadric.c). This code is well explained The Redbook text (http://www.opengl.org/documentation/red_book/) Chapter 11.

But to answer your question your code should look more like:

GLUquadric* qobj;

void init() // only call once on startup
qobj = gluNewQuadric();
gluQuadricNormals(qobj, GLU_SMOOTH);

void wheel() // use object in your drawing
gluCylinder(qobj, 1.0, 1.0, 0.4, 1, 16);

void cleanup() // call once when you exit program

Sythe Dragon
01-22-2010, 09:11 AM
Thank you very much, that at least put me in the right direction. After a few 'undeclared identifyer' copmiler errors i managed to crack it. And thanks for the example ill be sure to procure myself a copy of this redbook.