[Scummvm-git-logs] scummvm master -> 82e405a4ac19c9e36f3b9973064bca8c70163003
aquadran
aquadran at gmail.com
Mon Nov 8 07:57:24 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
82e405a4ac TINYGL: Fixed tglViewport transformation
Commit: 82e405a4ac19c9e36f3b9973064bca8c70163003
https://github.com/scummvm/scummvm/commit/82e405a4ac19c9e36f3b9973064bca8c70163003
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2021-11-08T08:57:19+01:00
Commit Message:
TINYGL: Fixed tglViewport transformation
Changed paths:
engines/myst3/gfx_tinygl.cpp
graphics/tinygl/vertex.cpp
diff --git a/engines/myst3/gfx_tinygl.cpp b/engines/myst3/gfx_tinygl.cpp
index 013e59e414..79d88e341c 100644
--- a/engines/myst3/gfx_tinygl.cpp
+++ b/engines/myst3/gfx_tinygl.cpp
@@ -83,15 +83,12 @@ void TinyGLRenderer::clear() {
}
void TinyGLRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled) {
- // NOTE: tinyGL viewport implementation needs to be checked as it doesn't behave the same as openGL
-
if (!window) {
// No window found ...
if (scaled) {
// ... in scaled mode draw in the original game screen area
Common::Rect vp = viewport();
- tglViewport(vp.left, vp.top, vp.width(), vp.height());
- //tglViewport(vp.left, _system->getHeight() - vp.top - vp.height(), vp.width(), vp.height());
+ tglViewport(vp.left, _system->getHeight() - vp.top - vp.height(), vp.width(), vp.height());
} else {
// ... otherwise, draw on the whole screen
tglViewport(0, 0, _system->getWidth(), _system->getHeight());
@@ -99,8 +96,7 @@ void TinyGLRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled)
} else {
// Found a window, draw inside it
Common::Rect vp = window->getPosition();
- tglViewport(vp.left, vp.top, vp.width(), vp.height());
- //tglViewport(vp.left, _system->getHeight() - vp.top - vp.height(), vp.width(), vp.height());
+ tglViewport(vp.left, _system->getHeight() - vp.top - vp.height(), vp.width(), vp.height());
}
if (is3D) {
diff --git a/graphics/tinygl/vertex.cpp b/graphics/tinygl/vertex.cpp
index c66cbdc8f5..2d3303b51f 100644
--- a/graphics/tinygl/vertex.cpp
+++ b/graphics/tinygl/vertex.cpp
@@ -74,11 +74,14 @@ void gl_eval_viewport(GLContext *c) {
v = &c->viewport;
+ // v->ymin needs to be upside down for transformation
+ int ymin = c->fb->ysize - v->ysize - v->ymin;
v->trans.X = (float)(((v->xsize - 0.5) / 2.0) + v->xmin);
- v->trans.Y = (float)(((v->ysize - 0.5) / 2.0) + v->ymin);
+ v->trans.Y = (float)(((v->ysize - 0.5) / 2.0) + ymin);
v->trans.Z = (float)(((zsize - 0.5) / 2.0) + ((1 << ZB_POINT_Z_FRAC_BITS)) / 2);
v->scale.X = (float)((v->xsize - 0.5) / 2.0);
+ // v->ysize needs to be upside down for scaling
v->scale.Y = (float)(-(v->ysize - 0.5) / 2.0);
v->scale.Z = (float)(-((zsize - 0.5) / 2.0));
}
More information about the Scummvm-git-logs
mailing list