From f35a9ff1b64f5c37c484dd7e4105c48afdb1b71f Mon Sep 17 00:00:00 2001 From: leozide Date: Fri, 1 Sep 2017 17:30:02 -0700 Subject: [PATCH] Set GL_TEXTURE_MAX_LEVEL. --- common/lc_texture.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/lc_texture.cpp b/common/lc_texture.cpp index da6aa36b..56517372 100644 --- a/common/lc_texture.cpp +++ b/common/lc_texture.cpp @@ -236,6 +236,7 @@ bool lcTexture::Load(Image* images, int NumLevels, int Flags) // todo: this shou void* Data = images[0].mData; glTexImage2D(GL_TEXTURE_2D, 0, Format, mWidth, mHeight, 0, Format, GL_UNSIGNED_BYTE, Data); + int MaxLevel = 0; if (Flags & LC_TEXTURE_MIPMAPS) { @@ -265,9 +266,11 @@ bool lcTexture::Load(Image* images, int NumLevels, int Flags) // todo: this shou Data = images[Level].mData; glTexImage2D(GL_TEXTURE_2D, Level, Format, Width, Height, 0, Format, GL_UNSIGNED_BYTE, Data); + MaxLevel++; } } + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel); glBindTexture(GL_TEXTURE_2D, 0); return true;