Bug 393073

Summary: Perspective incorrect texture mapping
Product: [Plasma] kwin Reporter: Vlad Zahorodnii <vlad.zahorodnii>
Component: scene-openglAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Window texture is not interpolated correctly across the trapezoid. There shouldn't be any triangles.

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.