diff options
author | Yoann Lopes <yoann.lopes@nokia.com> | 2010-09-16 16:45:38 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@nokia.com> | 2010-09-16 16:45:38 +0200 |
commit | b4adb3870147c2ffd65408279dba5804fa2271a8 (patch) | |
tree | 3d87a852109c8237da347adeb14e59b6824aa3df | |
parent | d8bcc8f00b21a1292e628801edec1d2086d44112 (diff) |
Fixes some texture states not being set.
-rw-r--r-- | declarativeviewtexture.cpp | 6 | ||||
-rw-r--r-- | ogrewidget.cpp | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/declarativeviewtexture.cpp b/declarativeviewtexture.cpp index bf7d6bc..67b6277 100644 --- a/declarativeviewtexture.cpp +++ b/declarativeviewtexture.cpp @@ -58,12 +58,14 @@ void DeclarativeViewTexture::paintEvent(QPaintEvent *event) // Upload the image in graphics memory glBindTexture(GL_TEXTURE_2D, m_textureId); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); qgl_byteSwapImage(im, GL_UNSIGNED_BYTE); foreach (const QRect &rect, exposedRegion.rects()) { if (rect.size() == size()) { glTexImage2D(GL_TEXTURE_2D, 0, 4, rect.width(), rect.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, im.bits()); - glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); break; } else { QRect adjustedRect = rect.translated(-exposedRegion.boundingRect().topLeft()); diff --git a/ogrewidget.cpp b/ogrewidget.cpp index 81edd0c..f66d65d 100644 --- a/ogrewidget.cpp +++ b/ogrewidget.cpp @@ -87,6 +87,10 @@ void OgreWidget::paintGL() // Render the QDeclarativeView texture on top glBindTexture(GL_TEXTURE_2D, m_QmlUI->textureId()); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -105,10 +109,10 @@ void OgreWidget::paintGL() float right = (rect().center().x() - m_QmlUI->pos().x() - m_QmlUI->width()) / float(-rect().center().x()); glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex3f(left, top, -1.0f); // Top Left - glTexCoord2f(0, 1); glVertex3f(left, bottom, -1.0f); // Bottom Left - glTexCoord2f(1, 1); glVertex3f(right, bottom, -1.0f); // Bottom Right - glTexCoord2f(1, 0); glVertex3f(right, top, -1.0f); // Top Right + glTexCoord2f(0.0, 0.0); glVertex3f(left, top, -1.0f); // Top Left + glTexCoord2f(0.0, 1.0); glVertex3f(left, bottom, -1.0f); // Bottom Left + glTexCoord2f(1.0, 1.0); glVertex3f(right, bottom, -1.0f); // Bottom Right + glTexCoord2f(1.0, 0.0); glVertex3f(right, top, -1.0f); // Top Right glEnd(); glBindTexture(GL_TEXTURE_2D, 0); |