From d4bbec4a0c35781de39d32cff1e45b3e9b5c4450 Mon Sep 17 00:00:00 2001 From: flashk Date: Tue, 2 Oct 2018 09:04:26 -0700 Subject: [PATCH] Fix hardware mipmap generation for cube maps I was getting a black image when enabling hardware mipmap generation on cubemaps. I believe the problem is that the base Texture class is hard coding GL_TEXTURE_2D when enabling mipmap generation, instead of using the target type from the derived class. --- src/osg/Texture.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 7dedf844d..2d3375f52 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -2752,7 +2752,7 @@ Texture::GenerateMipmapMode Texture::mipmapBeforeTexImage(const State& state, bo if (useGenerateMipMap) return GENERATE_MIPMAP; } - glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); + glTexParameteri(getTextureTarget(), GL_GENERATE_MIPMAP_SGIS, GL_TRUE); return GENERATE_MIPMAP_TEX_PARAMETER; #endif } @@ -2775,7 +2775,7 @@ void Texture::mipmapAfterTexImage(State& state, GenerateMipmapMode beforeResult) break; } case GENERATE_MIPMAP_TEX_PARAMETER: - glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE); + glTexParameteri(getTextureTarget(), GL_GENERATE_MIPMAP_SGIS, GL_FALSE); break; case GENERATE_MIPMAP_NONE: break;