Fix up examples for dynamic opengl builds

Change-Id: Id311b00fe7783a3175dc1c4a38f627c78c470761
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Laszlo Agocs 2014-04-24 14:36:57 +02:00 committed by The Qt Project
parent fd80cad07e
commit a57b8409a2
4 changed files with 15 additions and 8 deletions

View File

@ -171,6 +171,8 @@ void GLWidget::paintTexturedCube()
void GLWidget::initializeGL () void GLWidget::initializeGL ()
{ {
initializeOpenGLFunctions();
glClearColor(0.1f, 0.1f, 0.2f, 1.0f); glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
glGenTextures(1, &m_uiTexture); glGenTextures(1, &m_uiTexture);

View File

@ -42,15 +42,16 @@
#define GLWIDGET_H #define GLWIDGET_H
#include <QGLWidget> #include <QGLWidget>
#include <QtGui/qvector3d.h> #include <QOpenGLFunctions>
#include <QtGui/qmatrix4x4.h> #include <QGLShaderProgram>
#include <QtOpenGL/qglshaderprogram.h> #include <QVector3D>
#include <QMatrix4x4>
#include <QTime> #include <QTime>
#include <QVector> #include <QVector>
class Bubble; class Bubble;
class GLWidget : public QGLWidget { class GLWidget : public QGLWidget, protected QOpenGLFunctions
{
Q_OBJECT Q_OBJECT
public: public:
GLWidget(QWidget *parent = 0); GLWidget(QWidget *parent = 0);

View File

@ -182,7 +182,7 @@ void Renderer::paintQtLogo()
m_program->enableAttributeArray(vertexAttr); m_program->enableAttributeArray(vertexAttr);
m_program->setAttributeArray(vertexAttr, vertices.constData()); m_program->setAttributeArray(vertexAttr, vertices.constData());
m_program->setAttributeArray(normalAttr, normals.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(normalAttr);
m_program->disableAttributeArray(vertexAttr); m_program->disableAttributeArray(vertexAttr);
} }

View File

@ -2,7 +2,11 @@ requires(qtHaveModule(opengl))
TEMPLATE = subdirs TEMPLATE = subdirs
contains(QT_CONFIG, opengles2) { contains(QT_CONFIG, dynamicgl) {
SUBDIRS = hellowindow \
contextinfo \
hellogl_es2
} else: contains(QT_CONFIG, opengles2){
SUBDIRS = hellogl_es2 SUBDIRS = hellogl_es2
} else { } else {
SUBDIRS = 2dpainting \ SUBDIRS = 2dpainting \
@ -14,7 +18,7 @@ contains(QT_CONFIG, opengles2) {
samplebuffers samplebuffers
} }
SUBDIRS += hellowindow \ !contains(QT_CONFIG, dynamicgl): SUBDIRS += hellowindow \
paintedwindow \ paintedwindow \
contextinfo \ contextinfo \
cube \ cube \