Use QGLFunctions to fix OpenGL calls

This commit is contained in:
Matt Keeter 2014-03-21 17:31:34 -04:00
parent 41d81ccd8f
commit 2cabf7bf93
6 changed files with 12 additions and 3 deletions

View file

@ -2,6 +2,8 @@
Backdrop::Backdrop()
{
initializeGLFunctions();
shader.addShaderFromSourceFile(QGLShader::Vertex, ":/gl/quad.vert");
shader.addShaderFromSourceFile(QGLShader::Fragment, ":/gl/quad.frag");
shader.link();

View file

@ -1,10 +1,11 @@
#ifndef BACKDROP_H
#define BACKDROP_H
#include <QtOpenGL/QGLFunctions>
#include <QtOpenGL/QGLShaderProgram>
#include <QtOpenGL/QGLBuffer>
class Backdrop
class Backdrop : protected QGLFunctions
{
public:
Backdrop();

View file

@ -49,6 +49,8 @@ void Canvas::clear_status()
void Canvas::initializeGL()
{
initializeGLFunctions();
mesh_shader.addShaderFromSourceFile(QGLShader::Vertex, ":/gl/mesh.vert");
mesh_shader.addShaderFromSourceFile(QGLShader::Fragment, ":/gl/mesh.frag");
mesh_shader.link();

View file

@ -3,6 +3,7 @@
#include <QWidget>
#include <QtOpenGL/QGLWidget>
#include <QtOpenGL/QGLFunctions>
#include <QtOpenGL/QGLShaderProgram>
#include <QMatrix4x4>
@ -10,7 +11,7 @@ class GLMesh;
class Mesh;
class Backdrop;
class Canvas : public QGLWidget
class Canvas : public QGLWidget, protected QGLFunctions
{
Q_OBJECT

View file

@ -4,6 +4,8 @@
GLMesh::GLMesh(const Mesh* const mesh)
: vertices(QGLBuffer::VertexBuffer), indices(QGLBuffer::IndexBuffer)
{
initializeGLFunctions();
vertices.create();
indices.create();

View file

@ -2,10 +2,11 @@
#define GLMESH_H
#include <QtOpenGL/QGLBuffer>
#include <QtOpenGL/QGLFunctions>
class Mesh;
class GLMesh
class GLMesh : protected QGLFunctions
{
public:
GLMesh(const Mesh* const mesh);