1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

OpenGLContext: Re-bind previous program after copying texture

This commit is contained in:
reuk 2023-10-09 13:33:08 +01:00
parent f76799fde2
commit 9bf785f221
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -1607,6 +1607,11 @@ void OpenGLContext::copyTexture (const Rectangle<int>& targetClipArea,
auto bottom = (GLshort) targetClipArea.getBottom();
const GLshort vertices[] = { left, bottom, right, bottom, left, top, right, top };
GLint oldProgram{};
glGetIntegerv (GL_CURRENT_PROGRAM, &oldProgram);
const ScopeGuard bindPreviousProgram { [&] { extensions.glUseProgram ((GLuint) oldProgram); } };
auto& program = OverlayShaderProgram::select (*this);
program.params.set ((float) contextWidth, (float) contextHeight, anchorPosAndTextureSize.toFloat(), flippedVertically);