PDA

View Full Version : QT application with opengl and GLU



YuriyRusinov
9th June 2008, 12:17
Hello !

I try to make QT application with OpenGL graphics. I subclass QGLWidget and try draw cylinder such this


#include <QDebug>
#include <QMouseEvent>

#include <GL/glu.h>
#include <GL/glu_mangle.h>

#include "glwidget.h"

...

void GLWidget :: paintGL (void)
{
qDebug () << __FUNCTION__;
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GLUquadricObj* q = new gluNewQuadric ();
gluCylinder (q, (GLdouble)cyl_radius, (GLdouble)cyl_radius, (GLdouble)cyl_height, 1000, 1000);
}

and I receive an error


glwidget.cpp: In member function ‘virtual void GLWidget::paintGL()’:
glwidget.cpp:59: error: expected type-specifier before ‘mgluNewQuadric’
glwidget.cpp:59: error: cannot convert ‘int*’ to ‘GLUquadricObj*’ in initializat
ion
glwidget.cpp:59: error: expected ‘,’ or ‘;’ before ‘mgluNewQuadric’
glwidget.cpp:60: error: ‘mgluCylinder’ was not declared in this scope
make: *** [glwidget.o] Error 1
(3 of 7): error: expected type-specifier before ‘mgluNewQuadric’

In pro-file I write


DEPENDPATH += . \
/usr/include/GL
INCLUDEPATH += . \
/usr/include/GL

QT += opengl

...

My platform is Gentoo Linux, QT was compiled with opengl support. Any ideas ?

YuriyRusinov
9th June 2008, 13:20
I'm sorry, error was in


GLUquadricObj* q = new gluNewQuadric ();
,
I have to write


GLUquadricObj* q = gluNewQuadric ();