From 5ee410c1392492e3234a678b89c8490839e12a18 Mon Sep 17 00:00:00 2001 From: vlj Date: Wed, 9 Jul 2014 17:47:09 +0200 Subject: [PATCH] Use a default texture for transparent if not provided. --- src/graphics/render.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index 76143bf3f..ac44c00e7 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -833,7 +833,7 @@ void IrrDriver::renderTransparent() glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); for (unsigned i = 0; i < TransparentMeshes::MeshSet.size(); i++) { - const GLMesh &mesh = *TransparentMeshes::MeshSet[i]; + GLMesh &mesh = *TransparentMeshes::MeshSet[i]; if (mesh.VAOType != EVT_STANDARD) { #ifdef DEBUG @@ -843,11 +843,10 @@ void IrrDriver::renderTransparent() } - if (mesh.textures[0] != NULL) - { - compressTexture(mesh.textures[0], true); - setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true); - } + if (!mesh.textures[0]) + mesh.textures[0] = getUnicolorTexture(video::SColor(255, 255, 255, 255)); + compressTexture(mesh.textures[0], true); + setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true); draw(mesh, TransparentMeshes::MVPSet[i], TransparentMeshes::MeshSet[i]->TextureMatrix, fogmax, startH, endH, start, end, col, Camera::getCamera(0)->getCameraSceneNode()->getAbsolutePosition(), 0); if (mesh.VAOType != EVT_STANDARD) @@ -856,7 +855,7 @@ void IrrDriver::renderTransparent() glBlendFunc(GL_ONE, GL_ONE); for (unsigned i = 0; i < TransparentMeshes::MeshSet.size(); i++) { - const GLMesh &mesh = *TransparentMeshes::MeshSet[i]; + GLMesh &mesh = *TransparentMeshes::MeshSet[i]; if (mesh.VAOType != EVT_STANDARD) { #ifdef DEBUG @@ -866,11 +865,10 @@ void IrrDriver::renderTransparent() } glBindVertexArray(getVAO(mesh.VAOType)); - if (mesh.textures[0] != NULL) - { - compressTexture(mesh.textures[0], true); - setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true); - } + if (!mesh.textures[0]) + mesh.textures[0] = getUnicolorTexture(video::SColor(255, 255, 255, 255)); + compressTexture(mesh.textures[0], true); + setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true); draw(mesh, TransparentMeshes::MVPSet[i], TransparentMeshes::MeshSet[i]->TextureMatrix, fogmax, startH, endH, start, end, col, Camera::getCamera(0)->getCameraSceneNode()->getAbsolutePosition(), 0); if (mesh.VAOType != EVT_STANDARD) @@ -883,7 +881,7 @@ void IrrDriver::renderTransparent() glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); for (unsigned i = 0; i < TransparentMeshes::MeshSet.size(); i++) { - const GLMesh &mesh = *TransparentMeshes::MeshSet[i]; + GLMesh &mesh = *TransparentMeshes::MeshSet[i]; if (mesh.VAOType != EVT_STANDARD) { #ifdef DEBUG @@ -892,6 +890,8 @@ void IrrDriver::renderTransparent() glBindVertexArray(getVAO(mesh.VAOType)); } glBindVertexArray(getVAO(mesh.VAOType)); + if (!mesh.textures[0]) + mesh.textures[0] = getUnicolorTexture(video::SColor(255, 255, 255, 255)); compressTexture(mesh.textures[0], true); setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true); draw(mesh, TransparentMeshes::MVPSet[i], TransparentMeshes::MeshSet[i]->TextureMatrix, 0);