Bug 393073 - Perspective incorrect texture mapping
Summary: Perspective incorrect texture mapping
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: scene-opengl (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-12 21:18 UTC by Vlad Zahorodnii
Modified: 2018-10-28 21:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Window texture is not interpolated correctly across the trapezoid. There shouldn't be any triangles. (699.28 KB, image/png)
2018-04-12 21:18 UTC, Vlad Zahorodnii
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vlad Zahorodnii 2018-04-12 21:18:14 UTC
Created attachment 111982 [details]
Window texture is not interpolated correctly across the trapezoid. There shouldn't be any triangles.

Steps to reproduce:

* Apply the following patch
diff --git a/effects/magiclamp/magiclamp.cpp b/effects/magiclamp/magiclamp.cpp
index a392d4942..a95efa16c 100644
--- a/effects/magiclamp/magiclamp.cpp
+++ b/effects/magiclamp/magiclamp.cpp
@@ -91,7 +91,6 @@ void MagicLampEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data,
     if (mTimeLineWindows.contains(w)) {
         // We'll transform this window
         data.setTransformed();
-        data.quads = data.quads.makeGrid(40);
         w->enablePainting(EffectWindow::PAINT_DISABLED_BY_MINIMIZE);
     }

* Enable Magic lamp
* Set duration to 5000
* Minimize a window

Actual results:
Textures aren't properly mapped.

Expected results:
Textures should have been mapped something like this https://i.stack.imgur.com/yhL62.png
(source: https://gamedev.stackexchange.com/questions/29478/silly-question-about-perspective-correct-texture-mapping)

Please note that Magic lamp behaves weird when the grid consists only of 1 cell, but this bug report
not about that! This bug report about correct texture mapping when window quads have been transformed.

---

Another view on the problem: https://i.stack.imgur.com/2qVr1.png
(source: https://stackoverflow.com/questions/15242507/perspective-correct-texturing-of-trapezoid-in-opengl-es-2-0)

On the left hand side: what KWin is currently doing, on the right hand side: what KWin should do.
Comment 1 Vlad Zahorodnii 2018-10-28 21:55:16 UTC
Effects probably have to use tesselation/subdivide window grid. Having this bug fixed in the opengl scene is not worth it.