graesslin added inline comments.

INLINE COMMENTS

> broulik wrote in kwinglutils.cpp:1181
> I don't understand the maths, why is the "x" the negative 
> virtualScreenGeometry and "y" some formula?

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:

- 0,0x1920,1080
- 1280,0x1280,1024

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.

REPOSITORY
  rKWIN KWin

BRANCH
  render-target-viewport

REVISION DETAIL
  https://phabricator.kde.org/D3099

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: graesslin, #kwin, #plasma_on_wayland, mart
Cc: broulik, plasma-devel, kwin, lesliezhai, ali-mohamed, hardening, 
jensreuterberg, abetts, sebas

Reply via email to