summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFredrik Orderud <forderud@gmail.com>2015-09-06 21:50:59 +0200
committerFredrik Orderud <forderud@gmail.com>2015-09-11 06:20:15 +0000
commit0dd2554101e0ef5d703c89eb671066e56f56c1f4 (patch)
tree335dd9e024cdb04d5d5d3c3659cc14ef0fe9dda3 /examples
parent06713dd3cbcbcd83ae8029e44fddf789f661a76e (diff)
downloadqtactiveqt-0dd2554101e0ef5d703c89eb671066e56f56c1f4.tar.gz
Fix broken openglax by introducing QOpenGLFunctions_1_1.
The openglax example relies on deprecated OpenGL 1.1 functions that are no longer present in OpenGL ES 2. This leads to a missing symbols linker error. The problem is fixed by inheriting from QOpenGLFunctions_1_1 that provides implementations of the missing OpenGL functions. The GLBox destructor is also hardened with selective delete to avoid crashing if initializeGL is not called (occurs when dumping IDL). Change-Id: If35539749ab76293f98a5d75944f0f393f4d2a3c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/activeqt/activeqt.pro2
-rw-r--r--examples/activeqt/opengl/glbox.cpp6
-rw-r--r--examples/activeqt/opengl/glbox.h2
-rw-r--r--examples/activeqt/opengl/main.cpp4
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;
}