From 59abb2488c3375ef7e32a777deaacca8a48490cd Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Sat, 19 Dec 2015 14:32:27 +0100 Subject: 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 --- voronoisplat.cpp | 8 ++++++-- 1 file 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(); } -- cgit v1.2.3