From 5dcb7f622a2761c16ea40a6eecaa28b5c872da91 Mon Sep 17 00:00:00 2001 From: Olivier Prat Date: Thu, 19 Apr 2018 17:34:11 +0200 Subject: [PATCH] Fixed corrupted glViewport after call to generateMipWithPipeline --- libraries/gpu-gl-common/src/gpu/gl/GLBackendTexture.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackendTexture.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackendTexture.cpp index 410c52a1f6..48ef49186f 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackendTexture.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackendTexture.cpp @@ -118,6 +118,11 @@ void GLBackend::do_generateTextureMipsWithPipeline(const Batch& batch, size_t pa } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, numMips-1); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); + glBindFramebuffer(GL_FRAMEBUFFER, 0); resetOutputStage(); + // Restore viewport + ivec4& vp = _transform._viewport; + glViewport(vp.x, vp.y, vp.z, vp.w); }