-2

OpenGL glutWireCube works but glutWireCylinder doesn't.

glutWireCylinder throws an 'undefined' error. How can this be?

What am I doing wrong?

genpfault
  • 51,148
  • 11
  • 85
  • 139
  • 2
    According to this thread glutWireCylinder does not exist, but glu has a cylinder: https://www.opengl.org/discussion_boards/showthread.php/163726-glutSolidCylinder. – user3256930 Feb 11 '15 at 00:53

1 Answers1

0

That function is not defined because GLUT does not have a function named glutWireCylinder(). This is based on the official GLUT documentation here:

https://www.opengl.org/documentation/specs/glut/spec3/spec3.html

If you don't mind using legacy features, the GLU (GL Utility) library has a function for drawing cylinders (see man page for details).

// setup
GLUquadric* quadric = gluNewQuadric();
gluQuadricDrawStyle(quadric, GLU_LINE);

// drawing
gluCylinder(radius, radius, height, 32, 8);

// cleanup
gluDeleteQuadrc(quadric);

If you don't want to use deprecated libraries, writing code to draw a cylinder is easy to write yourself. My answer here shows how to draw a circle, which gets you most of the way to drawing a cylinder: How to draw a circle using VBO in ES2.0.

Community
  • 1
  • 1
Reto Koradi
  • 53,228
  • 8
  • 93
  • 133