From 7cb41f111706542da7e5391c99720acee6d2ac43 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Wed, 31 Mar 2010 12:32:15 +0200 Subject: Stub out QtOpenGL on Lighthouse & get it compiling --- config.tests/unix/opengldesktop/opengldesktop.cpp | 52 +++++ config.tests/unix/opengldesktop/opengldesktop.pro | 9 + configure | 77 +++++++- mkspecs/common/qws.conf | 4 - src/opengl/opengl.pro | 12 ++ src/opengl/qgl.cpp | 2 +- src/opengl/qgl_lite.cpp | 227 ++++++++++++++++++++++ src/opengl/qglpixelbuffer_p.h | 5 + src/opengl/qglpixelbuffer_stub.cpp | 84 ++++++++ 9 files changed, 457 insertions(+), 15 deletions(-) create mode 100644 config.tests/unix/opengldesktop/opengldesktop.cpp create mode 100644 config.tests/unix/opengldesktop/opengldesktop.pro create mode 100644 src/opengl/qgl_lite.cpp create mode 100644 src/opengl/qglpixelbuffer_stub.cpp diff --git a/config.tests/unix/opengldesktop/opengldesktop.cpp b/config.tests/unix/opengldesktop/opengldesktop.cpp new file mode 100644 index 0000000..969767c --- /dev/null +++ b/config.tests/unix/opengldesktop/opengldesktop.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +int main(int, char **) +{ + glBegin(GL_TRIANGLES); + glVertex2f(20.0f, 10.0f); + glVertex2f(10.0f, 30.0f); + glVertex2f(20.0f, 50.0f); + glEnd(); + return 0; +} diff --git a/config.tests/unix/opengldesktop/opengldesktop.pro b/config.tests/unix/opengldesktop/opengldesktop.pro new file mode 100644 index 0000000..ac70ca3 --- /dev/null +++ b/config.tests/unix/opengldesktop/opengldesktop.pro @@ -0,0 +1,9 @@ +SOURCES = opengldesktop.cpp +INCLUDEPATH += $$QMAKE_INCDIR_OPENGL + +for(p, QMAKE_LIBDIR_OPENGL) { + exists($$p):LIBS += -L$$p +} + +CONFIG -= qt +LIBS += $$QMAKE_LIBS_OPENGL diff --git a/configure b/configure index b27d6dd..ffaa498 100755 --- a/configure +++ b/configure @@ -5560,14 +5560,68 @@ if [ "$PLATFORM_MAC" = "yes" ]; then fi fi + +if [ "$PLATFORM_EMBLITE" = "yes" ]; then + # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es2 = OpenGL ES 2.x) + if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_OPENGL=desktop + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_OPENGL=es2 + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_OPENGL=es1 + else + if [ "$CFG_OPENGL" = "yes" ]; then + echo "All the OpenGL functionality tests failed!" + echo " You might need to modify the include and library search paths by editing" + echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" + echo " ${XQMAKESPEC}." + exit 1 + fi + CFG_OPENGL=no + fi + elif [ "$CFG_OPENGL" = "es1" ]; then + # OpenGL ES 1.x + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS + if [ $? != "0" ]; then + echo "The OpenGL ES 1.x functionality test failed!" + echo " You might need to modify the include and library search paths by editing" + echo " QMAKE_INCDIR_OPENGL_ES1, QMAKE_LIBDIR_OPENGL_ES1 and QMAKE_LIBS_OPENGL_ES1 in" + echo " ${XQMAKESPEC}." + exit 1 + fi + elif [ "$CFG_OPENGL" = "es2" ]; then + #OpenGL ES 2.x + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS + if [ $? != "0" ]; then + echo "The OpenGL ES 2.0 functionality test failed!" + echo " You might need to modify the include and library search paths by editing" + echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in" + echo " ${XQMAKESPEC}." + exit 1 + fi + elif [ "$CFG_OPENGL" = "desktop" ]; then + # Desktop OpenGL support + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS + if [ $? != "0" ]; then + echo "The OpenGL functionality test failed!" + echo " You might need to modify the include and library search paths by editing" + echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" + echo " ${XQMAKESPEC}." + exit 1 + fi + fi +fi + + # QWS -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" ]; then # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es2 = OpenGL ES 2.x) if [ "$CFG_OPENGL" = "yes" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then CFG_OPENGL=es2 - elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then CFG_OPENGL=es1 else echo "All the OpenGL ES functionality tests failed!" @@ -5578,22 +5632,22 @@ if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then fi elif [ "$CFG_OPENGL" = "es1" ]; then # OpenGL ES 1.x - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS if [ $? != "0" ]; then - echo "The OpenGL ES 1.x functionality test failed!" + echo "The OpenGL ES 1.x functionality test failed!" echo " You might need to modify the include and library search paths by editing" - echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" - echo " ${XQMAKESPEC}." + echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" + echo " ${XQMAKESPEC}." exit 1 fi elif [ "$CFG_OPENGL" = "es2" ]; then #OpenGL ES 2.x - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS if [ $? != "0" ]; then - echo "The OpenGL ES 2.0 functionality test failed!" + echo "The OpenGL ES 2.0 functionality test failed!" echo " You might need to modify the include and library search paths by editing" - echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" - echo " ${XQMAKESPEC}." + echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" + echo " ${XQMAKESPEC}." exit 1 fi elif [ "$CFG_OPENGL" = "desktop" ]; then @@ -5601,6 +5655,9 @@ if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then echo "Desktop OpenGL support is not avaliable on Qt for Embedded Linux" exit 1 fi +fi + +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then # screen drivers for screen in ${CFG_GFX_ON} ${CFG_GFX_PLUGIN}; do diff --git a/mkspecs/common/qws.conf b/mkspecs/common/qws.conf index 96341a7..2e8ae2c 100644 --- a/mkspecs/common/qws.conf +++ b/mkspecs/common/qws.conf @@ -12,9 +12,5 @@ QMAKE_INCREMENTAL_STYLE = sublib # modifications to linux.conf QMAKE_INCDIR_X11 = QMAKE_LIBDIR_X11 = -QMAKE_INCDIR_OPENGL = -QMAKE_LIBDIR_OPENGL = QMAKE_LIBS_X11 = QMAKE_LIBS_X11SM = -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_OPENGL_QT = diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index c111a8e..60d4b17 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -76,6 +76,18 @@ SOURCES += qgl.cpp \ } +embedded_lite { + SOURCES += qgl_lite.cpp + + # If we have EGL, use the EGL implementation of QGLPixelBuffer, otherwise we just provide + # a stubbed out one. PBuffers aren't too interesting anyway. + contains(QT_CONFIG, egl) { + SOURCES += qglpixelbuffer_egl.cpp + } else { + SOURCES += qglpixelbuffer_stub.cpp + } +} + x11 { contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) { SOURCES += qgl_x11egl.cpp \ diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e0030ad..7fcf390 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -95,7 +95,7 @@ QT_BEGIN_NAMESPACE -#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) +#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_WS_LITE) QGLExtensionFuncs QGLContextPrivate::qt_extensionFuncs; #endif diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp new file mode 100644 index 0000000..40417b1 --- /dev/null +++ b/src/opengl/qgl_lite.cpp @@ -0,0 +1,227 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgl.h" +#include "qgl_p.h" + +#include "qmap.h" +#include "qapplication.h" +#include "qcolormap.h" +#include "qdesktopwidget.h" +#include "qpixmap.h" +#include "qhash.h" +#include "qlibrary.h" +#include "qdebug.h" +#include + +QT_BEGIN_NAMESPACE + +bool QGLFormat::hasOpenGL() +{ + return true; // IMPLEMENT ME PROPERLY! +} + + + +bool QGLContext::chooseContext(const QGLContext* shareContext) +{ + // IMPLEMENT ME + return false; +} + + +void QGLContext::reset() +{ + Q_D(QGLContext); + if (!d->valid) + return; + d->cleanup(); + doneCurrent(); + + // IMPLEMENT ME + + d->crWin = false; + d->sharing = false; + d->valid = false; + d->transpColor = QColor(); + d->initDone = false; + QGLContextGroup::removeShare(this); +} + + +void QGLContext::makeCurrent() +{ + // IMPLEMENT ME +} + +void QGLContext::doneCurrent() +{ + // IMPLEMENT ME +} + + +void QGLContext::swapBuffers() const +{ + // IMPLEMENT ME +} + +void *QGLContext::getProcAddress(const QString &proc) const +{ + // IMPLEMENT ME +} + +void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget) +{ + // IMPLEMENT ME +} + + +void QGLWidget::setContext(QGLContext *context, + const QGLContext* shareContext, + bool deleteOldContext) +{ + // IMPLEMENT ME +} + + + + + + + +bool QGLFormat::hasOpenGLOverlays() +{ + return false; +} + +QColor QGLContext::overlayTransparentColor() const +{ + return QColor(); // Invalid color +} + +uint QGLContext::colorIndex(const QColor& c) const +{ + return 0; +} + +void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase) +{ + Q_UNUSED(fnt); + Q_UNUSED(listBase); +} + +/* + QGLTemporaryContext implementation +*/ +class QGLTemporaryContextPrivate +{ +public: + QGLWidget *widget; +}; + +QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) + : d(new QGLTemporaryContextPrivate) +{ + d->widget = new QGLWidget; + d->widget->makeCurrent(); +} + +QGLTemporaryContext::~QGLTemporaryContext() +{ + delete d->widget; +} + + +bool QGLWidgetPrivate::renderCxPm(QPixmap* pm) +{ + return false; +} + +/*! \internal + Free up any allocated colormaps. This fn is only called for + top-level widgets. +*/ +void QGLWidgetPrivate::cleanupColormaps() +{ +} + +void QGLWidget::setMouseTracking(bool enable) +{ + Q_UNUSED(enable); +} + +void QGLWidget::resizeEvent(QResizeEvent *) +{ + Q_D(QGLWidget); + if (!isValid()) + return; + makeCurrent(); + if (!d->glcx->initialized()) + glInit(); + resizeGL(width(), height()); +} + +const QGLContext* QGLWidget::overlayContext() const +{ + return 0; +} + +void QGLWidget::makeOverlayCurrent() +{ +} + + +void QGLWidget::updateOverlayGL() +{ +} + +const QGLColormap & QGLWidget::colormap() const +{ + Q_D(const QGLWidget); + return d->cmap; +} + +void QGLWidget::setColormap(const QGLColormap & c) +{ + Q_UNUSED(c); +} + +QT_END_NAMESPACE diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h index c85dc5a..bff35f5 100644 --- a/src/opengl/qglpixelbuffer_p.h +++ b/src/opengl/qglpixelbuffer_p.h @@ -200,6 +200,11 @@ public: QEglContext *ctx; int textureFormat; #endif +#if defined(Q_WS_LITE) + // Stubs + int pbuf; + int ctx; +#endif }; QT_END_NAMESPACE diff --git a/src/opengl/qglpixelbuffer_stub.cpp b/src/opengl/qglpixelbuffer_stub.cpp new file mode 100644 index 0000000..2caef6b --- /dev/null +++ b/src/opengl/qglpixelbuffer_stub.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qglpixelbuffer.h" +#include "qglpixelbuffer_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget) +{ + Q_UNUSED(size); + Q_UNUSED(f); + Q_UNUSED(shareWidget); + return false; +} + +bool QGLPixelBufferPrivate::cleanup() +{ + return false; +} + +bool QGLPixelBuffer::bindToDynamicTexture(GLuint texture_id) +{ + Q_UNUSED(texture_id); + return false; +} + +void QGLPixelBuffer::releaseFromDynamicTexture() +{ +} + +GLuint QGLPixelBuffer::generateDynamicTexture() const +{ + return 0; +} + +bool QGLPixelBuffer::hasOpenGLPbuffers() +{ + return false; +} + +QT_END_NAMESPACE -- cgit v0.12