Skip to content

Commit

Permalink
glGenerateMipmap honors base/max level
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelflinger committed Feb 16, 2019
1 parent 8f42e1a commit 28c8f68
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion filament/src/driver/opengl/OpenGLDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1759,14 +1759,15 @@ void OpenGLDriver::generateMipmaps(Driver::TextureHandle th) {
// color-renderable and filterable (i.e.: doesn't work for depth)
bindTexture(MAX_TEXTURE_UNITS - 1, t->gl.target, t, t->gl.targetIndex);
activeTexture(MAX_TEXTURE_UNITS - 1);
glGenerateMipmap(t->gl.target);

t->gl.baseLevel = 0;
t->gl.maxLevel = static_cast<uint8_t>(t->levels - 1);

glTexParameteri(t->gl.target, GL_TEXTURE_BASE_LEVEL, t->gl.baseLevel);
glTexParameteri(t->gl.target, GL_TEXTURE_MAX_LEVEL, t->gl.maxLevel);

glGenerateMipmap(t->gl.target);

CHECK_GL_ERROR(utils::slog.e)
}

Expand Down

0 comments on commit 28c8f68

Please sign in to comment.