Use QGLFunctions to fix OpenGL calls
This commit is contained in:
parent
41d81ccd8f
commit
2cabf7bf93
6 changed files with 12 additions and 3 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
Backdrop::Backdrop()
|
||||
{
|
||||
initializeGLFunctions();
|
||||
|
||||
shader.addShaderFromSourceFile(QGLShader::Vertex, ":/gl/quad.vert");
|
||||
shader.addShaderFromSourceFile(QGLShader::Fragment, ":/gl/quad.frag");
|
||||
shader.link();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
GLMesh::GLMesh(const Mesh* const mesh)
|
||||
: vertices(QGLBuffer::VertexBuffer), indices(QGLBuffer::IndexBuffer)
|
||||
{
|
||||
initializeGLFunctions();
|
||||
|
||||
vertices.create();
|
||||
indices.create();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue