using GLUT to draw a cylinder wireframe in VC.NET

Someone help me to resolve this problem . I used codes that i found on forums to draw a cylinder wireframe . But all i got a cylinder without diagonals . I want to draw one like on this picture . I’m totally newbie . So give me code in detail

Thanks in advance .

cylinder without diagonals may be because you are drawing square (gl_quads) and not triangles. squares is deprecated by now, so stick with triangles (i even wonder it triangles strip still are faster than normal triangles in current “all shader” gc architecture).

Thanks for your idea but it doesn’t solve my problem .

This is my code

#include <stdio.h>
#include <stdlib.h>
#include <glut.h>

GLuint startList;

void init(void) 
   GLUquadricObj *qobj;
   glClearColor(0.0, 0.0, 0.0, 0.0);

   qobj = gluNewQuadric();

   gluQuadricDrawStyle(qobj, GLU_LINE); /* flat shaded */
   gluQuadricNormals(qobj, GLU_SMOOTH);
   glNewList(startList+1, GL_COMPILE);
   gluCylinder(qobj, 0.5, 0.35, 1.1, 24, 6);



void display(void)

   glShadeModel (GL_SMOOTH);
   glTranslatef(0.0, 0.0, 0.0);
   glRotatef(327.0, 1.0, 0.0, 0.0);


void reshape (int w, int h)
   glViewport(0, 0, (GLsizei) w, (GLsizei) h);
         2.5*(GLfloat)w/(GLfloat)h, -2.5, 2.5, -10.0, 10.0);

int main(int argc, char** argv)
   glutInit(&argc, argv);
   glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
   glutInitWindowSize(500, 500); 
   glutInitWindowPosition(100, 100);
   return 0;

that’s right, it seems that this gluNewQuadric function initialize an quadratic object. I’m not familiar with glu/glut, as I manipulate all my forms using buffers for triangle’s indices and vertices. You should know that glu/glut are not opengl standards, they are libraries that use opengl functions (and others) under the hood in order to make opengl experience a bit less greedy. If you intend to use opengl more often and for more serious purpose you would be better to learn the core not relying to much on glu/glut as they are old and not necessarily up to date. The only functions I (sometimes) use are in your main() function. Maybe someone else more familiar with glu/glut could help you to obtain meshes with triangular faces.