aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2015-12-19 14:32:27 +0100
committerSamuel Fadel <samuelfadel@gmail.com>2015-12-19 14:32:27 +0100
commit59abb2488c3375ef7e32a777deaacca8a48490cd (patch)
treeb603d24da33d88f5f52ee65cecf49adfcafb0889
parentd7dd95cd9eaa223ff8b86e84e6b1b488ff79bcd5 (diff)
VoronoiSplat: more cleanup and values normalization.
* Added more cleanup code in destructor (VBOs & textures) * Scalar values are now normalized, as was expected by the shaders
-rw-r--r--voronoisplat.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/voronoisplat.cpp b/voronoisplat.cpp
index b8ab426..173dcc5 100644
--- a/voronoisplat.cpp
+++ b/voronoisplat.cpp
@@ -165,8 +165,12 @@ void VoronoiSplatRenderer::setupTextures()
VoronoiSplatRenderer::~VoronoiSplatRenderer()
{
- gl.glDeleteBuffers(2, m_VBOs);
+ gl.glDeleteBuffers(3, m_VBOs);
+ gl.glDeleteTextures(2, m_textures);
+ gl.glDeleteTextures(1, &m_colorMapTex);
+
delete m_program1;
+ delete m_program2;
}
void VoronoiSplatRenderer::setSites(const arma::mat &points)
@@ -258,7 +262,7 @@ void VoronoiSplatRenderer::setValues(const arma::vec &values)
m_values.data(), GL_DYNAMIC_DRAW);
int valueAttrib = m_program1->attributeLocation("scalar");
- gl.glVertexAttribPointer(valueAttrib, 1, GL_FLOAT, GL_FALSE, 0, 0);
+ gl.glVertexAttribPointer(valueAttrib, 1, GL_FLOAT, GL_TRUE, 0, 0);
gl.glEnableVertexAttribArray(valueAttrib);
m_sitesVAO.release();
}