summaryrefslogtreecommitdiffstats
path: root/examples/qwindow-compositor
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2011-12-05 17:09:02 +0100
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>2011-12-07 09:58:35 +0100
commit4c89518228012ddc3602eab405e4b5fb8108fcdf (patch)
tree615d4fdc38999e408d52998c39760064d223b652 /examples/qwindow-compositor
parent542eca71e074b5110df2aaf822449bf7d6ec2b91 (diff)
Make wayland actually a module
Also fix so that QtCompositor can be built as shared object. + fix so that the default QT_WAYLAND_GL_CONFIG is wayland_egl Change-Id: I02b72e99286584426bd37ab2d00bbc84af11efdc Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Diffstat (limited to 'examples/qwindow-compositor')
-rw-r--r--examples/qwindow-compositor/qwindow-compositor.pro16
-rw-r--r--examples/qwindow-compositor/surfacerenderer.cpp11
-rw-r--r--examples/qwindow-compositor/surfacerenderer.h4
3 files changed, 18 insertions, 13 deletions
diff --git a/examples/qwindow-compositor/qwindow-compositor.pro b/examples/qwindow-compositor/qwindow-compositor.pro
index 79f318a46..e154ad96e 100644
--- a/examples/qwindow-compositor/qwindow-compositor.pro
+++ b/examples/qwindow-compositor/qwindow-compositor.pro
@@ -6,10 +6,8 @@ INCLUDEPATH += .
# comment out the following to not use pkg-config in the pri files
CONFIG += use_pkgconfig
-DESTDIR=$$PWD/../../bin/
-
LIBS += -L ../../lib
-include (../../src/qt-compositor/qt-compositor.pri)
+#include (../../src/qt-compositor/qt-compositor.pri)
# Input
SOURCES += main.cpp \
@@ -21,10 +19,10 @@ CONFIG += qt warn_on debug create_prl link_prl
OBJECTS_DIR = .obj/release-shared
MOC_DIR = .moc/release-shared
-QT += gui opengl
+QT += gui
-target.path += $$[QT_INSTALL_BINS]
-INSTALLS += target
+QT += compositor
+#include(../../src/compositor/compositor.pri)
HEADERS += \
qopenglwindow.h \
@@ -32,3 +30,9 @@ HEADERS += \
qwindowcompositor.h
RESOURCES += qwindow-compositor.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qtwayland/qwindow-compositor
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS qwindow-compositor.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtwayland/qwindow-compositor
+INSTALLS += target sources
diff --git a/examples/qwindow-compositor/surfacerenderer.cpp b/examples/qwindow-compositor/surfacerenderer.cpp
index 42af69761..f160a3a0f 100644
--- a/examples/qwindow-compositor/surfacerenderer.cpp
+++ b/examples/qwindow-compositor/surfacerenderer.cpp
@@ -1,6 +1,7 @@
#include "surfacerenderer.h"
#include <QOpenGLFunctions>
+#include <QImage>
SurfaceRenderer::SurfaceRenderer(QOpenGLContext *context, QWindow *surface)
: m_context(context)
@@ -30,10 +31,10 @@ SurfaceRenderer::SurfaceRenderer(QOpenGLContext *context, QWindow *surface)
glBlendFunc (GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
//May need to manually set context here
- m_shaderProgram = new QGLShaderProgram();
+ m_shaderProgram = new QOpenGLShaderProgram();
- m_shaderProgram->addShaderFromSourceCode(QGLShader::Vertex, textureVertexProgram);
- m_shaderProgram->addShaderFromSourceCode(QGLShader::Fragment, textureFragmentProgram);
+ m_shaderProgram->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram);
+ m_shaderProgram->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram);
m_shaderProgram->link();
m_shaderProgram->bind();
@@ -97,13 +98,13 @@ void SurfaceRenderer::drawTexture(int textureId, const QRectF &geometry, int dep
GLuint SurfaceRenderer::textureFromImage(const QImage &image)
{
//TODO: Replace this line
- QImage convertedImage = QGLWidget::convertToGLFormat(image);
+ //QImage convertedImage = QGLWidget::convertToGLFormat(image);
GLuint textureId;
//Copy QImage data to Texture
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, convertedImage.width(), convertedImage.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, convertedImage.constBits());
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, image.constBits());
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
diff --git a/examples/qwindow-compositor/surfacerenderer.h b/examples/qwindow-compositor/surfacerenderer.h
index d2e03a47a..abfb554b0 100644
--- a/examples/qwindow-compositor/surfacerenderer.h
+++ b/examples/qwindow-compositor/surfacerenderer.h
@@ -2,7 +2,7 @@
#define SURFACERENDERER_H
#include <QOpenGLContext>
-#include <QGLShaderProgram>
+#include <QOpenGLShaderProgram>
#include <QWindow>
class SurfaceRenderer
@@ -18,7 +18,7 @@ private:
QOpenGLContext *m_context;
QWindow *m_surface;
- QGLShaderProgram *m_shaderProgram;
+ QOpenGLShaderProgram *m_shaderProgram;
QMatrix4x4 m_transformMatrix;
int m_matrixLocation;