summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2016-05-23 15:23:19 +0200
committerLars Knoll <lars.knoll@theqtcompany.com>2016-05-23 13:48:38 +0000
commit0b2fc2ee5d908de8316fef54c9f459a892545a8b (patch)
tree790456c4c4e2026bd3bd148eb98e6dd07ba553d8 /examples
parent61b552e886fdc34a3731abaaaa08f33059819e88 (diff)
Make example work for the non-streaming case
Don't crash when buffer is shared memory. Don't set m_texture to 0 when not streaming. Use the new buffer when advancing. Use proper filtering when uploading to texture. Change-Id: I05bb12a05c7448d17d5292910f16b49e613b0ce0 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Johan Helsing <johan.helsing@qt.io> Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com> Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/wayland/qwindow-compositor/windowcompositor.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/examples/wayland/qwindow-compositor/windowcompositor.cpp b/examples/wayland/qwindow-compositor/windowcompositor.cpp
index ecbbc5041..d3e3e1cf0 100644
--- a/examples/wayland/qwindow-compositor/windowcompositor.cpp
+++ b/examples/wayland/qwindow-compositor/windowcompositor.cpp
@@ -68,16 +68,21 @@ WindowCompositorView::WindowCompositorView()
GLuint WindowCompositorView::getTexture(GLenum *target)
{
QWaylandBufferRef buf = currentBuffer();
- m_texture = buf.textureForPlane(0);
+ GLuint streamingTexture = buf.textureForPlane(0);
+ if (streamingTexture)
+ m_texture = streamingTexture;
- if (buf.bufferFormatEgl() == QWaylandBufferRef::BufferFormatEgl_EXTERNAL_OES)
+ if (!buf.isShm() && buf.bufferFormatEgl() == QWaylandBufferRef::BufferFormatEgl_EXTERNAL_OES)
m_textureTarget = GL_TEXTURE_EXTERNAL_OES;
if (advance()) {
+ buf = currentBuffer();
if (!m_texture)
glGenTextures(1, &m_texture);
glBindTexture(m_textureTarget, m_texture);
+ if (buf.isShm())
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
buf.bindToTexture();
}