The viewport needs adjustment in the per-output rendering case. This
change ensures the viewport is setup like in the platforms which do per
output rendering. For the X11 case (multiple outputs in one render pass)
the values are the same as previously.
Details
- Reviewers
mart - Group Reviewers
Plasma on Wayland KWin - Commits
- R108:1708278a451e: Fix viewport restore in GLRenderTarget::popRenderTarget
Diff Detail
- Repository
- R108 KWin
- Branch
- render-target-viewport
- Lint
No Linters Available - Unit
No Unit Test Coverage
libkwineffects/kwinglutils.cpp | ||
---|---|---|
1181 | I don't understand the maths, why is the "x" the negative virtualScreenGeometry and "y" some formula? |
libkwineffects/kwinglutils.cpp | ||
---|---|---|
1181 | OpenGL has a different coordinate system. The 0/0 is on the bottom left corner unlike our own coordinate system which has 0/0 as the top left. The virtualScreenGeometry contains the geometry of the output we are currently rendering to in our coordinate system. E.g. two screens:
Now we need to map that into the coordinate system of OpenGL which has for the first screen a window of size 1920,1080 and for the second screen a window of 1280,1024 - both windows have the coordinate system start at 0/0 at the bottom left. What we try to do here is to map the rendering to the OpenGL window. Everything of the first screen needs to end up on the first OpenGL window, everything on the second screen needs to end up on the second OpenGL window. In both cases we need to adjust so that it becomes 0/0 from bottom left corner. Thus for x we need to take the negative. For the left most screen nothing changes, 0 is 0. For the right screen we need to ensure that 1920 gets mapped to 0. So negative x it is. Height is similarly adjusted, but is a little bit more complex as it also swaps the coordinate system. Always a mess. |