Implement transparancy for textures.

This commit is contained in:
2018-04-05 16:49:35 +02:00
parent 3e4452ca3a
commit 375833bc87
6 changed files with 21 additions and 17 deletions

View File

@@ -138,12 +138,13 @@ void fmri::setOrthographicProjection() {
glMatrixMode(GL_MODELVIEW);
}
void fmri::drawImageTiles(int n, const float *vertexBuffer, const float *textureCoords, const Texture &texture)
void fmri::drawImageTiles(int n, const float *vertexBuffer, const float *textureCoords, const Texture &texture, float alpha)
{
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glColor4f(1, 1, 1, alpha);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
texture.bind(GL_TEXTURE_2D);
glTexCoordPointer(2, GL_FLOAT, 0, textureCoords);
glVertexPointer(3, GL_FLOAT, 0, vertexBuffer);