From f7f76a1029be2e92e5d6834d8d40da6df9409db5 Mon Sep 17 00:00:00 2001 From: Julien Valentin Date: Sat, 4 Nov 2017 17:28:14 +0100 Subject: [PATCH] following guidance from OpenGL Common Mistakes: mipmaps should be upload with glTexImage2D and not glTexSubImage2D --- src/osg/Texture.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 25782619f..d43b0d665 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -2298,9 +2298,8 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima if (height == 0) height = 1; - glTexSubImage2D( target, k, - 0, 0, - width, height, + glTexImage2D( target, k, _internalFormat, + width, height, _borderWidth, (GLenum)image->getPixelFormat(), (GLenum)image->getDataType(), dataPtr + image->getMipmapOffset(k)); @@ -2603,12 +2602,11 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image* if (height == 0) height = 1; - glTexSubImage2D( target, k, - 0, 0, - width, height, - (GLenum)image->getPixelFormat(), - (GLenum)image->getDataType(), - dataPtr + image->getMipmapOffset(k)); + glTexImage2D( target, k, _internalFormat, + width, height, _borderWidth, + (GLenum)image->getPixelFormat(), + (GLenum)image->getDataType(), + dataPtr + image->getMipmapOffset(k)); width >>= 1; height >>= 1;