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()
    {
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(1,0,0);
    glBegin(GL_POLYGON);
    GLUquadricObj *obj = gluNewQuadric();

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

    }@

    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!

    jarope



  • 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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.