Implement a small texture wrapper.

Allows for RAII use of OpenGL textures.
This commit is contained in:
2018-02-25 19:03:10 +01:00
parent 23ae9717ea
commit 17d4e07025
6 changed files with 89 additions and 13 deletions

View File

@@ -49,18 +49,13 @@ MultiImageVisualisation::MultiImageVisualisation(const fmri::LayerData &layer)
}
}
MultiImageVisualisation::~MultiImageVisualisation()
{
glDeleteTextures(0, &texture);
}
void MultiImageVisualisation::render()
{
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(GL_TEXTURE_2D, texture);
texture.bind(GL_TEXTURE_2D);
glTexCoordPointer(2, GL_FLOAT, 0, texCoordBuffer.get());
glVertexPointer(3, GL_FLOAT, 0, vertexBuffer.get());
glDrawArrays(GL_QUADS, 0, nodePositions_.size() / 3 * 4);