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();
}
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();
}
To copy to clipboard, switch view to plain text mode
So, the question is, how do i make the Cylinder appear at the middle of the screen?
Added after 5 minutes:
Fixed. I was doing: glMatrixMode(GL_MODELVIEW); and glMatrixMode(GL_PROJECTION); in resizeGL() which seems to have caused this.
Bookmarks