Jump to content
  • Advertisement
Sign in to follow this  
Deanie

OpenGL Drawing a cylinder

This topic is 4333 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

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

Share this post


Link to post
Share on other sites
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.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!