Drawing a cylinder

Started by
0 comments, last by Zakwayda 17 years, 5 months ago
Hi all, Was wondering if any of you fine people could help me with a little openGL problem. I'm pretty new to openGL so my appologies if this is a rookie-mistake :) I'm trying to draw a cylinder using gluCylinder(). However my code compiles and runs ok but the cylinder is nowhere to be seen on screen. Here's the code I'm using (a slice of it, if you need more just ask :)):

void display(void)
{
   GLUquadricObj *myQuad;

   glClear(GL_COLOR_BUFFER_BIT);

   myQuad = gluNewQuadric();
   gluQuadricDrawstyle(myQuad, GLU_FILL);
   glColor3f(1.0, 1.0, 0.0);
   gluCylinder(myQuad, 0.2, 0.2, 0.5, 15, 15);

   gluDeleteQuadric(myQuad);
   glPushMatrix();glPopMatrix();glFlush();
}
Any ideas as to what I'm doing wrong? Any help is greatly appreciated :) -Dean
Advertisement
If and where the cylinder appears is determined by code you haven't shown us, specifically, how you've set up the projection and modelview matrices.

Also, pushing and popping the current OpenGL matrix as you're doing has no effect; those statements should be removed. (I'll also mention that I'm not sure what the effect of deleting your quadric before flushing might be. I'm guessing that's not part of the problem, but I could be wrong.)

This topic is closed to new replies.

Advertisement