Important: Please read the Qt Code of Conduct -

Cylinder with gluCylinder()

  • Well, what i'm trying to do is to draw a Cylinder using GLUquadricObj and gluCylinder, i don't get any code errors, compiles fine. However i don't see the cylinder.

    @void GLWindow::paintGL()
    GLUquadricObj *obj = gluNewQuadric();

    gluCylinder(obj, 1.0, 1, 3, 30, 30);


    So, the question is, how do i make the Cylinder appear at the middle of the screen?

  • Fixed. I was doing: glMatrixMode(GL_MODELVIEW); and glMatrixMode(GL_PROJECTION); in resizeGL() which seems to have caused this.

  • Hmm,

    something else to try as I continue to learn both OpenGL and Qt!


  • Ok Blastcore,

    Heres a question

    I added your lines to my simple window layout and did a build which kindly reminded me I had forgotten the include <GL/glu.h>

    But I still have issues so suspected the glu libs needed adding too. I tried LIBS += glu but this didnt get me anywhere.

    I am using Qt5.0.1 and have no issues with using basic GL_POLYGON but couldnt get the it to build. ( yep I have googled it!)

    would appreciated any guidance you can offer.

Log in to reply