aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-01-06 10:43:38 +0100
committerSamuel Fadel <samuelfadel@gmail.com>2016-01-06 10:43:38 +0100
commit87292bf4cc56194aa6122456d7417fa5f9bd1a09 (patch)
treede73014a71432b6365c238c954049eb53fc3c136
parent841ede5c34a5cb001b540ed13a8439dc8df7d2a9 (diff)
VoronoiSplat: upated to use Qt's FBO wrapper.
-rw-r--r--voronoisplat.cpp9
-rw-r--r--voronoisplat.h3
2 files changed, 4 insertions, 8 deletions
diff --git a/voronoisplat.cpp b/voronoisplat.cpp
index 7695d97..9c95950 100644
--- a/voronoisplat.cpp
+++ b/voronoisplat.cpp
@@ -2,9 +2,6 @@
#include <algorithm>
-#include <QQuickWindow>
-#include <QOpenGLFramebufferObject>
-
#include "scale.h"
#include "skelft.h"
@@ -24,13 +21,13 @@ static int nextPow2(int n)
VoronoiSplatTexture::VoronoiSplatTexture(const QSize &size)
: gl(QOpenGLContext::currentContext())
+ , m_FBO(size)
, m_cmap(3*COLORMAP_SAMPLES)
{
int baseSize = nextPow2(std::min(size.width(), size.height()));
m_size.setWidth(baseSize);
m_size.setHeight(baseSize);
- gl.glGenFramebuffers(1, &m_FBO);
setupShaders();
setupVAOs();
setupTextures();
@@ -205,8 +202,6 @@ VoronoiSplatTexture::~VoronoiSplatTexture()
gl.glDeleteTextures(1, &m_colormapTex);
gl.glDeleteTextures(1, &m_tex);
- gl.glDeleteFramebuffers(1, &m_FBO);
-
delete m_program1;
delete m_program2;
}
@@ -234,7 +229,7 @@ bool VoronoiSplatTexture::updateTexture()
updateColormap();
}
- gl.glBindFramebuffer(GL_FRAMEBUFFER, m_FBO);
+ m_FBO.bind();
// The first pass
m_program1->bind();
diff --git a/voronoisplat.h b/voronoisplat.h
index 78dfd3e..29c7f47 100644
--- a/voronoisplat.h
+++ b/voronoisplat.h
@@ -3,6 +3,7 @@
#include <QSGDynamicTexture>
#include <QOpenGLFunctions>
+#include <QOpenGLFramebufferObject>
#include <QOpenGLShaderProgram>
#include <QOpenGLVertexArrayObject>
#include <armadillo>
@@ -48,7 +49,7 @@ private:
QOpenGLFunctions gl;
QOpenGLShaderProgram *m_program1, *m_program2;
- GLuint m_FBO;
+ QOpenGLFramebufferObject m_FBO;
GLuint m_VBOs[3];
GLuint m_textures[2], m_colormapTex, m_tex;
QOpenGLVertexArrayObject m_sitesVAO, m_2ndPassVAO;