diff options
Diffstat (limited to 'examples/activeqt/opengl')
-rw-r--r-- | examples/activeqt/opengl/glbox.cpp | 6 | ||||
-rw-r--r-- | examples/activeqt/opengl/glbox.h | 2 | ||||
-rw-r--r-- | examples/activeqt/opengl/main.cpp | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/examples/activeqt/opengl/glbox.cpp b/examples/activeqt/opengl/glbox.cpp index 3f2b5bb..04c854c 100644 --- a/examples/activeqt/opengl/glbox.cpp +++ b/examples/activeqt/opengl/glbox.cpp @@ -78,7 +78,9 @@ GLBox::GLBox( QWidget* parent, const char* name ) GLBox::~GLBox() { makeCurrent(); - glDeleteLists( object, 1 ); + + if (object) + glDeleteLists( object, 1 ); } @@ -109,6 +111,8 @@ void GLBox::paintGL() void GLBox::initializeGL() { + initializeOpenGLFunctions(); + qglClearColor(Qt::black); // Let OpenGL clear to black object = makeObject(); // Generate an OpenGL display list glShadeModel( GL_FLAT ); diff --git a/examples/activeqt/opengl/glbox.h b/examples/activeqt/opengl/glbox.h index 53e3487..eb68c39 100644 --- a/examples/activeqt/opengl/glbox.h +++ b/examples/activeqt/opengl/glbox.h @@ -48,10 +48,12 @@ #define GLBOX_H #include <QtOpenGL> +#include <QOpenGLFunctions_1_1> //! [0] #include <QAxBindable> class GLBox : public QGLWidget, + public QOpenGLFunctions_1_1, public QAxBindable { Q_OBJECT diff --git a/examples/activeqt/opengl/main.cpp b/examples/activeqt/opengl/main.cpp index 861bf4e..0596b2b 100644 --- a/examples/activeqt/opengl/main.cpp +++ b/examples/activeqt/opengl/main.cpp @@ -72,8 +72,8 @@ int main( int argc, char **argv ) QApplication::setColorSpec( QApplication::CustomColor ); QApplication a(argc,argv); - if ( !QGLFormat::hasOpenGL() ) { - qWarning( "This system has no OpenGL support. Exiting." ); + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL) { + qWarning( "This system does not support OpenGL. Exiting." ); return -1; } |