aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Gräßlin <mgraesslin@kde.org>2011-10-15 12:14:44 (GMT)
committerMartin Gräßlin <mgraesslin@kde.org>2011-10-15 12:29:32 (GMT)
commitb22f64f95509c0b9f343c64e60bfcbe2b08d0a0a (patch)
treee35b9920250a2da81faa0c7d91934d2b0f08893b
parentcab2fee5c934ade31d457d470b042b578f74b9d8 (diff)
Generate texture coordinates for limited NPOT support
Fixes rendering issues with R300 and similar GPUs. If the texture uses GL_TEXTURE_RECTANGLE_ARB as target the tex coordinates need to be adjusted. This at least fixes missing text on EffectFrames with graphicssystem native on R300. Hopefully more issues are resolved by the change. BUG: 269576 CCBUG: 282882 FIXED-IN: 4.7.3
-rw-r--r--kwin/libkwineffects/kwinglutils.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/kwin/libkwineffects/kwinglutils.cpp b/kwin/libkwineffects/kwinglutils.cpp
index 87a4625..7460b3c 100644
--- a/kwin/libkwineffects/kwinglutils.cpp
+++ b/kwin/libkwineffects/kwinglutils.cpp
@@ -444,11 +444,18 @@ void GLTexture::render(QRegion region, const QRect& rect)
r.x() + rect.width(), r.y(),
r.x() + rect.width(), r.y() + rect.height()
};
+#ifdef KWIN_HAVE_OPENGLES
+ const float texWidth = 1.0f;
+ const float texHeight = 1.0f;
+#else
+ const float texWidth = (target() == GL_TEXTURE_RECTANGLE_ARB) ? width() : 1.0f;
+ const float texHeight = (target() == GL_TEXTURE_RECTANGLE_ARB) ? height() : 1.0f;
+#endif
const float texcoords[ 4 * 2 ] = {
- 0.0f, y_inverted ? 0.0f : 1.0f, // y needs to be swapped (normalized coords)
- 0.0f, y_inverted ? 1.0f : 0.0f,
- 1.0f, y_inverted ? 0.0f : 1.0f,
- 1.0f, y_inverted ? 1.0f : 0.0f
+ 0.0f, d->m_yInverted ? 0.0f : texHeight, // y needs to be swapped (normalized coords)
+ 0.0f, d->m_yInverted ? texHeight : 0.0f,
+ texWidth, d->m_yInverted ? 0.0f : texHeight,
+ texWidth, d->m_yInverted ? texHeight : 0.0f
};
m_vbo->setData(4, 2, verts, texcoords);
}