Skip to content

Commit

Permalink
Fix up examples for dynamic opengl builds
Browse files Browse the repository at this point in the history
Change-Id: Id311b00fe7783a3175dc1c4a38f627c78c470761
Reviewed-by: Jørgen Lind <[email protected]>
Reviewed-by: Friedemann Kleint <[email protected]>
  • Loading branch information
Laszlo Agocs authored and The Qt Project committed May 12, 2014
1 parent fd80cad commit a57b840
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions examples/opengl/hellogl_es2/glwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ void GLWidget::paintTexturedCube()

void GLWidget::initializeGL ()
{
initializeOpenGLFunctions();

glClearColor(0.1f, 0.1f, 0.2f, 1.0f);

glGenTextures(1, &m_uiTexture);
Expand Down
11 changes: 6 additions & 5 deletions examples/opengl/hellogl_es2/glwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion examples/opengl/hellowindow/hellowindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 6 additions & 2 deletions examples/opengl/opengl.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -14,7 +18,7 @@ contains(QT_CONFIG, opengles2) {
samplebuffers
}

SUBDIRS += hellowindow \
!contains(QT_CONFIG, dynamicgl): SUBDIRS += hellowindow \
paintedwindow \
contextinfo \
cube \
Expand Down

0 comments on commit a57b840

Please sign in to comment.