GE Debugger: Fix preview when zooming.

Before, the coordinates were only right when scaled to fit.  When you
zoomed in and panned, it would show in the wrong place because it wasn't
accounting for the flipped backbuffer.
This commit is contained in:
Unknown W. Brackets 2017-12-23 01:31:04 -08:00
parent 2031b2ef98
commit a32ccd3eb8

View File

@ -189,8 +189,9 @@ void CGEDebugger::UpdatePrimPreview(u32 op) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquation(GL_FUNC_ADD);
glBindTexture(GL_TEXTURE_2D, 0);
glViewport((GLint)x, (GLint)y, (GLsizei)fw, (GLsizei)fh);
glScissor((GLint)x, (GLint)y, (GLsizei)fw, (GLsizei)fh);
// The surface is upside down, so vertical offsets are negated.
glViewport((GLint)x, (GLint)-(y + fh - primaryWindow->Height()), (GLsizei)fw, (GLsizei)fh);
glScissor((GLint)x, (GLint)-(y + fh - primaryWindow->Height()), (GLsizei)fw, (GLsizei)fh);
BindPreviewProgram(previewProgram);
// TODO: Probably there's a better way and place to do this.
@ -277,8 +278,9 @@ void CGEDebugger::UpdatePrimPreview(u32 op) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquation(GL_FUNC_ADD);
glBindTexture(GL_TEXTURE_2D, 0);
glViewport((GLint)x, (GLint)y, (GLsizei)fw, (GLsizei)fh);
glScissor((GLint)x, (GLint)y, (GLsizei)fw, (GLsizei)fh);
// The surface is upside down, so vertical offsets are flipped.
glViewport((GLint)x, (GLint)-(y + fh - secondWindow->Height()), (GLsizei)fw, (GLsizei)fh);
glScissor((GLint)x, (GLint)-(y + fh - secondWindow->Height()), (GLsizei)fw, (GLsizei)fh);
BindPreviewProgram(texPreviewProgram);
if (texPreviewVao == 0 && gl_extensions.ARB_vertex_array_object) {