diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/opengl/hellogl_es2/glwidget.cpp | 2 | ||||
-rw-r--r-- | examples/opengl/hellogl_es2/glwidget.h | 11 | ||||
-rw-r--r-- | examples/opengl/hellowindow/hellowindow.cpp | 2 | ||||
-rw-r--r-- | examples/opengl/opengl.pro | 8 |
4 files changed, 15 insertions, 8 deletions
diff --git a/examples/opengl/hellogl_es2/glwidget.cpp b/examples/opengl/hellogl_es2/glwidget.cpp index 7267cfd124..733475d321 100644 --- a/examples/opengl/hellogl_es2/glwidget.cpp +++ b/examples/opengl/hellogl_es2/glwidget.cpp @@ -171,6 +171,8 @@ void GLWidget::paintTexturedCube() void GLWidget::initializeGL () { + initializeOpenGLFunctions(); + glClearColor(0.1f, 0.1f, 0.2f, 1.0f); glGenTextures(1, &m_uiTexture); diff --git a/examples/opengl/hellogl_es2/glwidget.h b/examples/opengl/hellogl_es2/glwidget.h index 8ed86b1e01..00073aa047 100644 --- a/examples/opengl/hellogl_es2/glwidget.h +++ b/examples/opengl/hellogl_es2/glwidget.h @@ -42,15 +42,16 @@ #define GLWIDGET_H #include <QGLWidget> -#include <QtGui/qvector3d.h> -#include <QtGui/qmatrix4x4.h> -#include <QtOpenGL/qglshaderprogram.h> +#include <QOpenGLFunctions> +#include <QGLShaderProgram> +#include <QVector3D> +#include <QMatrix4x4> #include <QTime> #include <QVector> class Bubble; -class GLWidget : public QGLWidget { - +class GLWidget : public QGLWidget, protected QOpenGLFunctions +{ Q_OBJECT public: GLWidget(QWidget *parent = 0); diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp index 3b5971c0d3..b4dc4464ba 100644 --- a/examples/opengl/hellowindow/hellowindow.cpp +++ b/examples/opengl/hellowindow/hellowindow.cpp @@ -182,7 +182,7 @@ void Renderer::paintQtLogo() m_program->enableAttributeArray(vertexAttr); m_program->setAttributeArray(vertexAttr, vertices.constData()); m_program->setAttributeArray(normalAttr, normals.constData()); - glDrawArrays(GL_TRIANGLES, 0, vertices.size()); + m_context->functions()->glDrawArrays(GL_TRIANGLES, 0, vertices.size()); m_program->disableAttributeArray(normalAttr); m_program->disableAttributeArray(vertexAttr); } diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro index 7bc96234df..aea281ce5c 100644 --- a/examples/opengl/opengl.pro +++ b/examples/opengl/opengl.pro @@ -2,7 +2,11 @@ requires(qtHaveModule(opengl)) TEMPLATE = subdirs -contains(QT_CONFIG, opengles2) { +contains(QT_CONFIG, dynamicgl) { + SUBDIRS = hellowindow \ + contextinfo \ + hellogl_es2 +} else: contains(QT_CONFIG, opengles2){ SUBDIRS = hellogl_es2 } else { SUBDIRS = 2dpainting \ @@ -14,7 +18,7 @@ contains(QT_CONFIG, opengles2) { samplebuffers } -SUBDIRS += hellowindow \ +!contains(QT_CONFIG, dynamicgl): SUBDIRS += hellowindow \ paintedwindow \ contextinfo \ cube \ |