diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/activeqt/activeqt.pro | 2 | ||||
-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 |
4 files changed, 10 insertions, 4 deletions
diff --git a/examples/activeqt/activeqt.pro b/examples/activeqt/activeqt.pro index 1fe8bee..dcfdb81 100644 --- a/examples/activeqt/activeqt.pro +++ b/examples/activeqt/activeqt.pro @@ -7,7 +7,7 @@ SUBDIRS += comapp \ wrapper contains(QT_CONFIG, shared):SUBDIRS += webbrowser -contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2):!contains(QT_CONFIG, dynamicgl): SUBDIRS += opengl +contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2): SUBDIRS += opengl # For now only the contain examples with mingw, for the others you need # an IDL compiler 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; } |