diff options
author | Sarah Smith <sarah.j.smith@nokia.com> | 2011-03-15 16:36:36 +1000 |
---|---|---|
committer | Sarah Smith <sarah.j.smith@nokia.com> | 2011-03-15 16:36:36 +1000 |
commit | c1e9c29ddb3ab1e56bbd649bca54865561c74037 (patch) | |
tree | 162a0b2cb4d5bbb974bc213886a2927a611d8dda /src | |
parent | 24f57d45f10824fcfa4076c45e47a8b22e86e8d1 (diff) |
Make quick3d build without private headers.
It compiles and basket runs on MacOSX - almost certainly most other apps
are broken on most other platforms. Got to start somewhere.
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/threed/shaderprogram.cpp | 116 | ||||
-rw-r--r-- | src/imports/threed/shaderprogram.h | 2 | ||||
-rw-r--r-- | src/imports/threed/shaderprogram_p.h | 6 | ||||
-rw-r--r-- | src/private/private.pri | 9 | ||||
-rw-r--r-- | src/private/qdeclarativeglobal_p.h | 110 | ||||
-rw-r--r-- | src/private/qfactoryloader_p.h | 93 | ||||
-rw-r--r-- | src/private/qglextensions_p.h | 884 | ||||
-rw-r--r-- | src/quick3d/qdeclarativeeffect.cpp | 143 | ||||
-rw-r--r-- | src/quick3d/qdeclarativeeffect.h | 5 | ||||
-rw-r--r-- | src/quick3d/qdeclarativeitem3d.cpp | 106 | ||||
-rw-r--r-- | src/quick3d/qdeclarativeitem3d.h | 20 | ||||
-rw-r--r-- | src/quick3d/qdeclarativemesh.h | 2 | ||||
-rw-r--r-- | src/quick3d/qdeclarativeviewport.h | 2 | ||||
-rw-r--r-- | src/quick3d/qsgpretransformnode.h | 2 | ||||
-rw-r--r-- | src/quick3d/qt3dquickglobal.h | 2 | ||||
-rw-r--r-- | src/quick3d/quick3d.pro | 3 | ||||
-rw-r--r-- | src/threed/painting/qglext.cpp | 3 | ||||
-rw-r--r-- | src/threed/scene/qglabstractscene.cpp | 4 | ||||
-rw-r--r-- | src/threed/threed.pro | 4 |
19 files changed, 1205 insertions, 311 deletions
diff --git a/src/imports/threed/shaderprogram.cpp b/src/imports/threed/shaderprogram.cpp index e0fbddeed..6fc933349 100644 --- a/src/imports/threed/shaderprogram.cpp +++ b/src/imports/threed/shaderprogram.cpp @@ -45,7 +45,6 @@ #include <QtOpenGL/qglshaderprogram.h> #include <QWeakPointer> -#include "private/qdeclarativepixmapcache_p.h" #include <QDeclarativeEngine> #include <QDeclarativeContext> @@ -245,9 +244,6 @@ ShaderProgramEffect::~ShaderProgramEffect() QGLTexture2D* texture; foreach (texture, textures) delete texture; - QDeclarativePixmap* declarativePixmap; - foreach (declarativePixmap, declarativePixmaps) - delete declarativePixmap; } /* @@ -397,15 +393,15 @@ void ShaderProgramEffect::update { foreach (int i, changedTextures) { - if (!declarativePixmaps.contains(i)) + if (!images.contains(i)) { changedTextures.remove(i); continue; } - if (declarativePixmaps[i]->isReady()) + if (!images[i].isNull()) { - setUniform(i, declarativePixmaps[i]->pixmap(), painter); + setUniform(i, images[i], painter); } else { qWarning() << "Warning: ShaderProgramEffect failed to apply texture for uniform" << i << (urls.contains(i) ? QLatin1String(" url: ") + urls[i] : QString()); @@ -596,41 +592,6 @@ void ShaderProgramEffect::setPropertyDirty(int property) } /*! - \internal Notification received via parent ShaderProgram parent that - a requested network resource is ready, so load the pixmap and get - ready for painting with it. - - Returns true if the Effect has finished loading all it's remote resources. -*/ -bool ShaderProgramEffect::pixmapRequestFinished() -{ - bool removedTexture = false; - foreach (int i, loadingTextures) - { - if (!declarativePixmaps.contains(i)) - { - loadingTextures.remove(i); - removedTexture = true; - continue; - } - - if (declarativePixmaps[i]->isReady()) - { - changedTextures.insert(i); - loadingTextures.remove(i); - removedTexture = true; - } else if (!declarativePixmaps[i]->isLoading()) - { - qWarning() << "Error loading " << urls[i] << ": " - << declarativePixmaps[i]->error(); - loadingTextures.remove(i); - removedTexture = true; - } - } - return (removedTexture && loadingTextures.count() == 0); -} - -/*! \internal Update the image for the texture bound at \a uniform location with the the image at \a urlString. If \a urlString is a remote resource, this starts an asycnrounous loading process. @@ -644,9 +605,9 @@ void ShaderProgramEffect::processTextureUrl(int uniformLocation, QString urlStri urls.contains(uniformLocation) && !urls[uniformLocation].isNull()) { - if (!declarativePixmaps[uniformLocation]->isNull()) + if (images.contains(uniformLocation) && !images[uniformLocation].isNull()) { - declarativePixmaps[uniformLocation]->clear(parent.data()); + images[uniformLocation] = QImage(); urls.remove(uniformLocation); changedTextures.insert(uniformLocation); return; @@ -680,37 +641,35 @@ void ShaderProgramEffect::processTextureUrl(int uniformLocation, QString urlStri if (urlString != urls[uniformLocation]) { - urls.insert(uniformLocation, urlString); - if (declarativePixmaps.contains(uniformLocation)) - declarativePixmaps[uniformLocation]->clear(); - else - declarativePixmaps[uniformLocation] = new QDeclarativePixmap(); - - QDeclarativePixmap* declarativePixmap = - declarativePixmaps[uniformLocation]; - QDeclarativeEngine *engine = qmlEngine(parent.data()); -#if QT_VERSION >= 0x040702 - QDeclarativePixmap::Options options = QDeclarativePixmap::Cache; - if (async) - options |= QDeclarativePixmap::Asynchronous; - declarativePixmap->load(engine, urlString, options); -#else - declarativePixmap->load(engine, urlString, async); -#endif - - QDeclarativePixmap::Status status = - declarativePixmap->status(); - if ( status == QDeclarativePixmap::Ready) + if (url.scheme() != QLatin1String("file")) { - changedTextures.insert(uniformLocation); - return; - } else if (status == QDeclarativePixmap::Loading) + // TODO - support network URL's for loading - note that this feature is for + // the Qt3D 1.1 release and there is no point in implementing it until for example + // model loading and all other parts of Qt3D support it. Also when it is implemented + // it has to be done with a facility that does not depend on private headers in + // QtDeclarative which can change within minor dot-point releases. + qWarning("Network URL's not yet supported - %s", qPrintable(urlString)); + } + else { - declarativePixmap->connectFinished(parent.data(), SLOT(pixmapRequestFinished())); - loadingTextures.insert(uniformLocation); - } else { - qWarning() << "Failed to load texture " << urlString << ": " - << declarativePixmap->error(); + QString localFile = url.toLocalFile(); + if (localFile.endsWith(QLatin1String(".dds"))) + { + qWarning("Shader effects with compressed textures not supported: %s", + qPrintable(urlString)); + } + else + { + QImage im(localFile); + if (im.isNull()) + { + qWarning("Could not load image from local file path - %s", qPrintable(localFile)); + } + else + { + images[uniformLocation] = im; + } + } } } } @@ -847,17 +806,6 @@ void ShaderProgram::markPropertyDirty(int property) */ /*! - \internal Proxy the signal for the ShaderProgramEffect class - */ -void ShaderProgram::pixmapRequestFinished() -{ - if (d->effect->pixmapRequestFinished()) - { - emit finishedLoading(); - } -} - -/*! \internal A subclass without the Q_OBJECT macro in order to use the qt_metacall trick to track property changes. diff --git a/src/imports/threed/shaderprogram.h b/src/imports/threed/shaderprogram.h index 881976043..19ee99547 100644 --- a/src/imports/threed/shaderprogram.h +++ b/src/imports/threed/shaderprogram.h @@ -72,8 +72,6 @@ public Q_SLOTS: Q_SIGNALS: void finishedLoading(); void shaderChanged(); -private Q_SLOTS: - void pixmapRequestFinished(); private: ShaderProgramPrivate *d; }; diff --git a/src/imports/threed/shaderprogram_p.h b/src/imports/threed/shaderprogram_p.h index f8506b01c..e2027b19a 100644 --- a/src/imports/threed/shaderprogram_p.h +++ b/src/imports/threed/shaderprogram_p.h @@ -47,12 +47,9 @@ #include "qdeclarativeeffect.h" #include "qglshaderprogrameffect.h" -#include "private/qdeclarativepixmapcache_p.h" class ShaderProgram; - class ShaderProgramEffect; -class QDeclarativePixmapReply; /*! \internal @@ -117,7 +114,6 @@ public: void setPropertiesDirty(); void setPropertyDirty(int property); - bool pixmapRequestFinished(); void setAttributeFields(QGL::VertexAttribute fields); protected: void processTextureUrl(int uniformLocation, QString urlString); @@ -141,7 +137,7 @@ private: // Thes maps are all referenced by uniform location QMap<int, QGLTexture2D*> texture2Ds; - QMap<int, QDeclarativePixmap*> declarativePixmaps; + QMap<int, QImage> images; QMap<int, QString> urls; // These are sets of uniform locations diff --git a/src/private/private.pri b/src/private/private.pri new file mode 100644 index 000000000..ae4ceab1a --- /dev/null +++ b/src/private/private.pri @@ -0,0 +1,9 @@ +INCLUDEPATH += $$PWD +VPATH += $$PWD + +PRIVATE_HEADERS += \ + qdeclarativeglobal_p.h \ + qfactoryloader_p.h \ + qglextensions_p.h + + diff --git a/src/private/qdeclarativeglobal_p.h b/src/private/qdeclarativeglobal_p.h new file mode 100644 index 000000000..6d195c73c --- /dev/null +++ b/src/private/qdeclarativeglobal_p.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative 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$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEGLOBAL_H +#define QDECLARATIVEGLOBAL_H + +#include <QtCore/qglobal.h> +#include <QtCore/QObject> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +#define DEFINE_BOOL_CONFIG_OPTION(name, var) \ + static bool name() \ + { \ + static enum { Yes, No, Unknown } status = Unknown; \ + if (status == Unknown) { \ + QByteArray v = qgetenv(#var); \ + bool value = !v.isEmpty() && v != "0" && v != "false"; \ + if (value) status = Yes; \ + else status = No; \ + } \ + return status == Yes; \ + } + +#ifdef Q_OS_SYMBIAN +#define Q_DECLARATIVE_PRIVATE_EXPORT Q_AUTOTEST_EXPORT +#else +#define Q_DECLARATIVE_PRIVATE_EXPORT Q_DECLARATIVE_EXPORT +#endif + +struct QDeclarativeGraphics_DerivedObject : public QObject +{ + void setParent_noEvent(QObject *parent) { + bool sce = d_ptr->sendChildEvents; + d_ptr->sendChildEvents = false; + setParent(parent); + d_ptr->sendChildEvents = sce; + } +}; + +/*! + Returns true if the case of \a fileName is equivalent to the file case of + \a fileName on disk, and false otherwise. + + This is used to ensure that the behavior of QML on a case-insensitive file + system is the same as on a case-sensitive file system. This function + performs a "best effort" attempt to determine the real case of the file. + It may have false positives (say the case is correct when it isn't), but it + should never have a false negative (say the case is incorrect when it is + correct). +*/ +bool QDeclarative_isFileCaseCorrect(const QString &fileName); + +/*! + Makes the \a object a child of \a parent. Note that when using this method, + neither \a parent nor the object's previous parent (if it had one) will + receive ChildRemoved or ChildAdded events. +*/ +inline void QDeclarative_setParent_noEvent(QObject *object, QObject *parent) +{ + static_cast<QDeclarativeGraphics_DerivedObject *>(object)->setParent_noEvent(parent); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEGLOBAL_H diff --git a/src/private/qfactoryloader_p.h b/src/private/qfactoryloader_p.h new file mode 100644 index 000000000..57432ddd3 --- /dev/null +++ b/src/private/qfactoryloader_p.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore 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$ +** +****************************************************************************/ + +#ifndef QFACTORYLOADER_P_H +#define QFACTORYLOADER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "QtCore/qobject.h" +#include "QtCore/qstringlist.h" +//#include "private/qlibrary_p.h" + +#ifndef QT_NO_LIBRARY + +QT_BEGIN_NAMESPACE + +class QFactoryLoaderPrivate; + +class Q_CORE_EXPORT QFactoryLoader : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QFactoryLoader) + +public: + QFactoryLoader(const char *iid, + const QString &suffix = QString(), + Qt::CaseSensitivity = Qt::CaseSensitive); + ~QFactoryLoader(); + + QStringList keys() const; + QObject *instance(const QString &key) const; + +#ifdef Q_WS_X11 + QLibraryPrivate *library(const QString &key) const; +#endif + + void update(); + + static void refreshAll(); +}; + +QT_END_NAMESPACE + +#endif // QT_NO_LIBRARY + +#endif // QFACTORYLOADER_P_H diff --git a/src/private/qglextensions_p.h b/src/private/qglextensions_p.h new file mode 100644 index 000000000..8dfcd39f3 --- /dev/null +++ b/src/private/qglextensions_p.h @@ -0,0 +1,884 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** +****************************************************************************/ + +#ifndef QGL_EXTENSIONS_P_H +#define QGL_EXTENSIONS_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the Qt OpenGL classes. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +// extension prototypes +#ifndef Q_WS_MAC +# ifndef APIENTRYP +# ifdef APIENTRY +# define APIENTRYP APIENTRY * +# else +# define APIENTRY +# define APIENTRYP * +# endif +# endif +#else +# define APIENTRY +# define APIENTRYP * +#endif + +#include <QtCore/qglobal.h> + +#ifndef GL_ARB_vertex_buffer_object +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +#endif + +#ifndef GL_VERSION_2_0 +typedef char GLchar; +#endif + +// ARB_vertex_buffer_object +typedef void (APIENTRY *_glBindBuffer) (GLenum, GLuint); +typedef void (APIENTRY *_glDeleteBuffers) (GLsizei, const GLuint *); +typedef void (APIENTRY *_glGenBuffers) (GLsizei, GLuint *); +typedef void (APIENTRY *_glBufferData) (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); +typedef void (APIENTRY *_glBufferSubData) (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *); +typedef void (APIENTRY *_glGetBufferSubData) (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *); +typedef void (APIENTRY *_glGetBufferParameteriv) (GLenum, GLenum, GLint *); +typedef GLvoid* (APIENTRY *_glMapBufferARB) (GLenum, GLenum); +typedef GLboolean (APIENTRY *_glUnmapBufferARB) (GLenum); +// We can call the buffer functions directly in OpenGL/ES 1.1 or higher, +// but all other platforms need to resolve the extensions. +#if defined(QT_OPENGL_ES) +#if defined(GL_OES_VERSION_1_0) && !defined(GL_OES_VERSION_1_1) +#define QGL_RESOLVE_BUFFER_FUNCS 1 +#endif +#else +#define QGL_RESOLVE_BUFFER_FUNCS 1 +#endif + +// ARB_fragment_program +typedef void (APIENTRY *_glProgramStringARB) (GLenum, GLenum, GLsizei, const GLvoid *); +typedef void (APIENTRY *_glBindProgramARB) (GLenum, GLuint); +typedef void (APIENTRY *_glDeleteProgramsARB) (GLsizei, const GLuint *); +typedef void (APIENTRY *_glGenProgramsARB) (GLsizei, GLuint *); +typedef void (APIENTRY *_glProgramLocalParameter4fvARB) (GLenum, GLuint, const GLfloat *); + +// GLSL +typedef GLuint (APIENTRY *_glCreateShader) (GLenum); +typedef void (APIENTRY *_glShaderSource) (GLuint, GLsizei, const char **, const GLint *); +typedef void (APIENTRY *_glShaderBinary) (GLint, const GLuint*, GLenum, const void*, GLint); +typedef void (APIENTRY *_glCompileShader) (GLuint); +typedef void (APIENTRY *_glDeleteShader) (GLuint); +typedef GLboolean (APIENTRY *_glIsShader) (GLuint); + +typedef GLuint (APIENTRY *_glCreateProgram) (); +typedef void (APIENTRY *_glAttachShader) (GLuint, GLuint); +typedef void (APIENTRY *_glDetachShader) (GLuint, GLuint); +typedef void (APIENTRY *_glLinkProgram) (GLuint); +typedef void (APIENTRY *_glUseProgram) (GLuint); +typedef void (APIENTRY *_glDeleteProgram) (GLuint); +typedef GLboolean (APIENTRY *_glIsProgram) (GLuint); + +typedef void (APIENTRY *_glGetShaderInfoLog) (GLuint, GLsizei, GLsizei *, char *); +typedef void (APIENTRY *_glGetShaderiv) (GLuint, GLenum, GLint *); +typedef void (APIENTRY *_glGetShaderSource) (GLuint, GLsizei, GLsizei *, char *); +typedef void (APIENTRY *_glGetProgramiv) (GLuint, GLenum, GLint *); +typedef void (APIENTRY *_glGetProgramInfoLog) (GLuint, GLsizei, GLsizei *, char *); + +typedef GLuint (APIENTRY *_glGetUniformLocation) (GLuint, const char*); +typedef void (APIENTRY *_glUniform4fv) (GLint, GLsizei, const GLfloat *); +typedef void (APIENTRY *_glUniform3fv) (GLint, GLsizei, const GLfloat *); +typedef void (APIENTRY *_glUniform2fv) (GLint, GLsizei, const GLfloat *); +typedef void (APIENTRY *_glUniform1fv) (GLint, GLsizei, const GLfloat *); +typedef void (APIENTRY *_glUniform1i) (GLint, GLint); +typedef void (APIENTRY *_glUniform1iv) (GLint, GLsizei, const GLint *); +typedef void (APIENTRY *_glUniformMatrix2fv) (GLint, GLsizei, GLboolean, const GLfloat *); +typedef void (APIENTRY *_glUniformMatrix3fv) (GLint, GLsizei, GLboolean, const GLfloat *); +typedef void (APIENTRY *_glUniformMatrix4fv) (GLint, GLsizei, GLboolean, const GLfloat *); +typedef void (APIENTRY *_glUniformMatrix2x3fv) (GLint, GLsizei, GLboolean, const GLfloat *); +typedef void (APIENTRY *_glUniformMatrix2x4fv) (GLint, GLsizei, GLboolean, const GLfloat *); +typedef void (APIENTRY *_glUniformMatrix3x2fv) (GLint, GLsizei, GLboolean, const GLfloat *); +typedef void (APIENTRY *_glUniformMatrix3x4fv) (GLint, GLsizei, GLboolean, const GLfloat *); +typedef void (APIENTRY *_glUniformMatrix4x2fv) (GLint, GLsizei, GLboolean, const GLfloat *); +typedef void (APIENTRY *_glUniformMatrix4x3fv) (GLint, GLsizei, GLboolean, const GLfloat *); + +typedef void (APIENTRY *_glBindAttribLocation) (GLuint, GLuint, const char *); +typedef GLint (APIENTRY *_glGetAttribLocation) (GLuint, const char *); +typedef void (APIENTRY *_glVertexAttrib1fv) (GLuint, const GLfloat *); +typedef void (APIENTRY *_glVertexAttrib2fv) (GLuint, const GLfloat *); +typedef void (APIENTRY *_glVertexAttrib3fv) (GLuint, const GLfloat *); +typedef void (APIENTRY *_glVertexAttrib4fv) (GLuint, const GLfloat *); +typedef void (APIENTRY *_glVertexAttribPointer) (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +typedef void (APIENTRY *_glDisableVertexAttribArray) (GLuint); +typedef void (APIENTRY *_glEnableVertexAttribArray) (GLuint); + +typedef void (APIENTRY *_glGetProgramBinaryOES) (GLuint, GLsizei, GLsizei *, GLenum *, void *); +typedef void (APIENTRY *_glProgramBinaryOES) (GLuint, GLenum, const void *, GLint); + + +typedef void (APIENTRY *_glMultiTexCoord4f) (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +typedef void (APIENTRY *_glActiveStencilFaceEXT) (GLenum ); + +// Needed for GL2 engine: +typedef void (APIENTRY *_glStencilOpSeparate) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRY *_glActiveTexture) (GLenum); +typedef void (APIENTRY *_glBlendColor) (GLclampf, GLclampf, GLclampf, GLclampf); + + +// EXT_GL_framebuffer_object +typedef GLboolean (APIENTRY *_glIsRenderbuffer) (GLuint renderbuffer); +typedef void (APIENTRY *_glBindRenderbuffer) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRY *_glDeleteRenderbuffers) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRY *_glGenRenderbuffers) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRY *_glRenderbufferStorage) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRY *_glGetRenderbufferParameteriv) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRY *_glIsFramebuffer) (GLuint framebuffer); +typedef void (APIENTRY *_glBindFramebuffer) (GLenum target, GLuint framebuffer); +typedef void (APIENTRY *_glDeleteFramebuffers) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRY *_glGenFramebuffers) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRY *_glCheckFramebufferStatus) (GLenum target); +typedef void (APIENTRY *_glFramebufferTexture2D) (GLenum target, GLenum attachment, GLenum textarget, + GLuint texture, GLint level); +typedef void (APIENTRY *_glFramebufferRenderbuffer) (GLenum target, GLenum attachment, GLenum renderbuffertarget, + GLuint renderbuffer); +typedef void (APIENTRY *_glGetFramebufferAttachmentParameteriv) (GLenum target, GLenum attachment, GLenum pname, + GLint *params); +typedef void (APIENTRY *_glGenerateMipmap) (GLenum target); + +// EXT_GL_framebuffer_blit +typedef void (APIENTRY *_glBlitFramebufferEXT) (int srcX0, int srcY0, int srcX1, int srcY1, + int dstX0, int dstY0, int dstX1, int dstY1, + GLbitfield mask, GLenum filter); + +// EXT_GL_framebuffer_multisample +typedef void (APIENTRY *_glRenderbufferStorageMultisampleEXT) (GLenum target, GLsizei samples, + GLenum internalformat, GLsizei width, GLsizei height); + +// GL_EXT_geometry_shader4 +typedef void (APIENTRY *_glProgramParameteriEXT)(GLuint program, GLenum pname, GLint value); +typedef void (APIENTRY *_glFramebufferTextureEXT)(GLenum target, GLenum attachment, + GLuint texture, GLint level); +typedef void (APIENTRY *_glFramebufferTextureLayerEXT)(GLenum target, GLenum attachment, + GLuint texture, GLint level, GLint layer); +typedef void (APIENTRY *_glFramebufferTextureFaceEXT)(GLenum target, GLenum attachment, + GLuint texture, GLint level, GLenum face); + +// ARB_texture_compression +typedef void (APIENTRY *_glCompressedTexImage2DARB) (GLenum, GLint, GLenum, GLsizei, + GLsizei, GLint, GLsizei, const GLvoid *); + +QT_BEGIN_NAMESPACE + +struct QGLExtensionFuncs +{ + QGLExtensionFuncs() { +#if !defined(QT_OPENGL_ES_2) + qt_glProgramStringARB = 0; + qt_glBindProgramARB = 0; + qt_glDeleteProgramsARB = 0; + qt_glGenProgramsARB = 0; + qt_glProgramLocalParameter4fvARB = 0; + + // GLSL + qt_glCreateShader = 0; + qt_glShaderSource = 0; + qt_glShaderBinary = 0; + qt_glCompileShader = 0; + qt_glDeleteShader = 0; + qt_glIsShader = 0; + + qt_glCreateProgram = 0; + qt_glAttachShader = 0; + qt_glDetachShader = 0; + qt_glLinkProgram = 0; + qt_glUseProgram = 0; + qt_glDeleteProgram = 0; + qt_glIsProgram = 0; + + qt_glGetShaderInfoLog = 0; + qt_glGetShaderiv = 0; + qt_glGetShaderSource = 0; + qt_glGetProgramiv = 0; + qt_glGetProgramInfoLog = 0; + + qt_glGetUniformLocation = 0; + qt_glUniform4fv = 0; + qt_glUniform3fv = 0; + qt_glUniform2fv = 0; + qt_glUniform1fv = 0; + qt_glUniform1i = 0; + qt_glUniform1iv = 0; + qt_glUniformMatrix2fv = 0; + qt_glUniformMatrix3fv = 0; + qt_glUniformMatrix4fv = 0; + qt_glUniformMatrix2x3fv = 0; + qt_glUniformMatrix2x4fv = 0; + qt_glUniformMatrix3x2fv = 0; + qt_glUniformMatrix3x4fv = 0; + qt_glUniformMatrix4x2fv = 0; + qt_glUniformMatrix4x3fv = 0; + + qt_glBindAttribLocation = 0; + qt_glGetAttribLocation = 0; + qt_glVertexAttrib1fv = 0; + qt_glVertexAttrib2fv = 0; + qt_glVertexAttrib3fv = 0; + qt_glVertexAttrib4fv = 0; + qt_glVertexAttribPointer = 0; + qt_glDisableVertexAttribArray = 0; + qt_glEnableVertexAttribArray = 0; + + // Extras for GL2 engine: + qt_glActiveTexture = 0; + qt_glStencilOpSeparate = 0; + qt_glBlendColor = 0; + + qt_glActiveStencilFaceEXT = 0; + qt_glMultiTexCoord4f = 0; +#else + qt_glslResolved = false; + + qt_glGetProgramBinaryOES = 0; + qt_glProgramBinaryOES = 0; +#endif + + // FBOs +#if !defined(QT_OPENGL_ES_2) + qt_glIsRenderbuffer = 0; + qt_glBindRenderbuffer = 0; + qt_glDeleteRenderbuffers = 0; + qt_glGenRenderbuffers = 0; + qt_glRenderbufferStorage = 0; + qt_glGetRenderbufferParameteriv = 0; + qt_glIsFramebuffer = 0; + qt_glBindFramebuffer = 0; + qt_glDeleteFramebuffers = 0; + qt_glGenFramebuffers = 0; + qt_glCheckFramebufferStatus = 0; + qt_glFramebufferTexture2D = 0; + qt_glFramebufferRenderbuffer = 0; + qt_glGetFramebufferAttachmentParameteriv = 0; + qt_glGenerateMipmap = 0; +#endif + qt_glBlitFramebufferEXT = 0; + qt_glRenderbufferStorageMultisampleEXT = 0; + + // Buffer objects: +#if defined(QGL_RESOLVE_BUFFER_FUNCS) + qt_glBindBuffer = 0; + qt_glDeleteBuffers = 0; + qt_glGenBuffers = 0; + qt_glBufferData = 0; + qt_glBufferSubData = 0; + qt_glGetBufferSubData = 0; + qt_glGetBufferParameteriv = 0; +#endif + qt_glMapBufferARB = 0; + qt_glUnmapBufferARB = 0; + + qt_glProgramParameteriEXT = 0; + qt_glFramebufferTextureEXT = 0; + qt_glFramebufferTextureLayerEXT = 0; + qt_glFramebufferTextureFaceEXT = 0; +#if !defined(QT_OPENGL_ES) + // Texture compression + qt_glCompressedTexImage2DARB = 0; +#endif + +#ifndef QT_NO_EGL + // OES_EGL_image + qt_glEGLImageTargetTexture2DOES = 0; + qt_glEGLImageTargetRenderbufferStorageOES = 0; +#endif + } + + +#if !defined(QT_OPENGL_ES_2) + _glProgramStringARB qt_glProgramStringARB; + _glBindProgramARB qt_glBindProgramARB; + _glDeleteProgramsARB qt_glDeleteProgramsARB; + _glGenProgramsARB qt_glGenProgramsARB; + _glProgramLocalParameter4fvARB qt_glProgramLocalParameter4fvARB; + + // GLSL definitions + _glCreateShader qt_glCreateShader; + _glShaderSource qt_glShaderSource; + _glShaderBinary qt_glShaderBinary; + _glCompileShader qt_glCompileShader; + _glDeleteShader qt_glDeleteShader; + _glIsShader qt_glIsShader; + + _glCreateProgram qt_glCreateProgram; + _glAttachShader qt_glAttachShader; + _glDetachShader qt_glDetachShader; + _glLinkProgram qt_glLinkProgram; + _glUseProgram qt_glUseProgram; + _glDeleteProgram qt_glDeleteProgram; + _glIsProgram qt_glIsProgram; + + _glGetShaderInfoLog qt_glGetShaderInfoLog; + _glGetShaderiv qt_glGetShaderiv; + _glGetShaderSource qt_glGetShaderSource; + _glGetProgramiv qt_glGetProgramiv; + _glGetProgramInfoLog qt_glGetProgramInfoLog; + + _glGetUniformLocation qt_glGetUniformLocation; + _glUniform4fv qt_glUniform4fv; + _glUniform3fv qt_glUniform3fv; + _glUniform2fv qt_glUniform2fv; + _glUniform1fv qt_glUniform1fv; + _glUniform1i qt_glUniform1i; + _glUniform1iv qt_glUniform1iv; + _glUniformMatrix2fv qt_glUniformMatrix2fv; + _glUniformMatrix3fv qt_glUniformMatrix3fv; + _glUniformMatrix4fv qt_glUniformMatrix4fv; + _glUniformMatrix2x3fv qt_glUniformMatrix2x3fv; + _glUniformMatrix2x4fv qt_glUniformMatrix2x4fv; + _glUniformMatrix3x2fv qt_glUniformMatrix3x2fv; + _glUniformMatrix3x4fv qt_glUniformMatrix3x4fv; + _glUniformMatrix4x2fv qt_glUniformMatrix4x2fv; + _glUniformMatrix4x3fv qt_glUniformMatrix4x3fv; + + _glBindAttribLocation qt_glBindAttribLocation; + _glGetAttribLocation qt_glGetAttribLocation; + _glVertexAttrib1fv qt_glVertexAttrib1fv; + _glVertexAttrib2fv qt_glVertexAttrib2fv; + _glVertexAttrib3fv qt_glVertexAttrib3fv; + _glVertexAttrib4fv qt_glVertexAttrib4fv; + _glVertexAttribPointer qt_glVertexAttribPointer; + _glDisableVertexAttribArray qt_glDisableVertexAttribArray; + _glEnableVertexAttribArray qt_glEnableVertexAttribArray; + +#else + bool qt_glslResolved; + + _glGetProgramBinaryOES qt_glGetProgramBinaryOES; + _glProgramBinaryOES qt_glProgramBinaryOES; +#endif + + _glActiveStencilFaceEXT qt_glActiveStencilFaceEXT; + _glMultiTexCoord4f qt_glMultiTexCoord4f; + +#if !defined(QT_OPENGL_ES_2) + // Extras needed for GL2 engine: + _glActiveTexture qt_glActiveTexture; + _glStencilOpSeparate qt_glStencilOpSeparate; + _glBlendColor qt_glBlendColor; + +#endif + + // FBOs +#if !defined(QT_OPENGL_ES_2) + _glIsRenderbuffer qt_glIsRenderbuffer; + _glBindRenderbuffer qt_glBindRenderbuffer; + _glDeleteRenderbuffers qt_glDeleteRenderbuffers; + _glGenRenderbuffers qt_glGenRenderbuffers; + _glRenderbufferStorage qt_glRenderbufferStorage; + _glGetRenderbufferParameteriv qt_glGetRenderbufferParameteriv; + _glIsFramebuffer qt_glIsFramebuffer; + _glBindFramebuffer qt_glBindFramebuffer; + _glDeleteFramebuffers qt_glDeleteFramebuffers; + _glGenFramebuffers qt_glGenFramebuffers; + _glCheckFramebufferStatus qt_glCheckFramebufferStatus; + _glFramebufferTexture2D qt_glFramebufferTexture2D; + _glFramebufferRenderbuffer qt_glFramebufferRenderbuffer; + _glGetFramebufferAttachmentParameteriv qt_glGetFramebufferAttachmentParameteriv; + _glGenerateMipmap qt_glGenerateMipmap; +#endif + _glBlitFramebufferEXT qt_glBlitFramebufferEXT; + _glRenderbufferStorageMultisampleEXT qt_glRenderbufferStorageMultisampleEXT; + + // Buffer objects +#if defined(QGL_RESOLVE_BUFFER_FUNCS) + _glBindBuffer qt_glBindBuffer; + _glDeleteBuffers qt_glDeleteBuffers; + _glGenBuffers qt_glGenBuffers; + _glBufferData qt_glBufferData; + _glBufferSubData qt_glBufferSubData; + _glGetBufferSubData qt_glGetBufferSubData; + _glGetBufferParameteriv qt_glGetBufferParameteriv; +#endif + _glMapBufferARB qt_glMapBufferARB; + _glUnmapBufferARB qt_glUnmapBufferARB; + + // Geometry shaders... + _glProgramParameteriEXT qt_glProgramParameteriEXT; + _glFramebufferTextureEXT qt_glFramebufferTextureEXT; + _glFramebufferTextureLayerEXT qt_glFramebufferTextureLayerEXT; + _glFramebufferTextureFaceEXT qt_glFramebufferTextureFaceEXT; +#if !defined(QT_OPENGL_ES) + // Texture compression + _glCompressedTexImage2DARB qt_glCompressedTexImage2DARB; +#endif + +#ifndef QT_NO_EGL + // OES_EGL_image + _glEGLImageTargetTexture2DOES qt_glEGLImageTargetTexture2DOES; + _glEGLImageTargetRenderbufferStorageOES qt_glEGLImageTargetRenderbufferStorageOES; +#endif +}; + + +// OpenGL constants + +#ifndef GL_ARRAY_BUFFER +#define GL_ARRAY_BUFFER 0x8892 +#endif + +#ifndef GL_STATIC_DRAW +#define GL_STATIC_DRAW 0x88E4 +#endif + +/* NV_texture_rectangle */ +#ifndef GL_NV_texture_rectangle +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 +#endif + +#ifndef GL_BGRA +#define GL_BGRA 0x80E1 +#endif + +#ifndef GL_RGB16 +#define GL_RGB16 0x8054 +#endif + +#ifndef GL_UNSIGNED_SHORT_5_6_5 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#endif + +#ifndef GL_UNSIGNED_INT_8_8_8_8_REV +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#endif + +#ifndef GL_MULTISAMPLE +#define GL_MULTISAMPLE 0x809D +#endif + +#ifndef GL_CLAMP_TO_EDGE +#define GL_CLAMP_TO_EDGE 0x812F +#endif + +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_IBM 0x8370 +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif + +// ARB_fragment_program extension protos +#ifndef GL_FRAGMENT_PROGRAM_ARB +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#endif + +#ifndef GL_PIXEL_UNPACK_BUFFER_ARB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#endif + +#ifndef GL_WRITE_ONLY_ARB +#define GL_WRITE_ONLY_ARB 0x88B9 +#endif + +#ifndef GL_STREAM_DRAW_ARB +#define GL_STREAM_DRAW_ARB 0x88E0 +#endif + +// Stencil wrap and two-side defines +#ifndef GL_STENCIL_TEST_TWO_SIDE_EXT +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#endif +#ifndef GL_INCR_WRAP_EXT +#define GL_INCR_WRAP_EXT 0x8507 +#endif +#ifndef GL_DECR_WRAP_EXT +#define GL_DECR_WRAP_EXT 0x8508 +#endif + +#ifndef GL_TEXTURE0 +#define GL_TEXTURE0 0x84C0 +#endif + +#ifndef GL_TEXTURE1 +#define GL_TEXTURE1 0x84C1 +#endif + +#ifndef GL_DEPTH_COMPONENT16 +#define GL_DEPTH_COMPONENT16 0x81A5 +#endif + +#ifndef GL_DEPTH_COMPONENT24_OES +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_STENCIL_INDEX_EXT 0x8D45 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +#endif + +// GL_EXT_framebuffer_blit +#ifndef GL_READ_FRAMEBUFFER_EXT +#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 +#endif + +// GL_EXT_framebuffer_multisample +#ifndef GL_RENDERBUFFER_SAMPLES_EXT +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#endif + +#ifndef GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#endif + +#ifndef GL_MAX_SAMPLES_EXT +#define GL_MAX_SAMPLES_EXT 0x8D57 +#endif + +#ifndef GL_DRAW_FRAMEBUFFER_EXT +#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 +#endif + +#ifndef GL_EXT_packed_depth_stencil +#define GL_DEPTH_STENCIL_EXT 0x84F9 +#define GL_UNSIGNED_INT_24_8_EXT 0x84FA +#define GL_DEPTH24_STENCIL8_EXT 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 +#endif + +// ### hm. should be part of the GL 1.2 spec.. +#ifndef GL_CLAMP_TO_EDGE +#define GL_CLAMP_TO_EDGE 0x812F +#endif + +#ifndef GL_VERSION_1_2 +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#endif + +#ifndef GL_VERSION_1_4 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#endif + +#ifndef GL_VERSION_1_5 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#endif + +#ifndef GL_VERSION_2_0 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#endif + +// Geometry shader defines +#ifndef GL_GEOMETRY_SHADER_EXT +# define GL_GEOMETRY_SHADER_EXT 0x8DD9 +# define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA +# define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB +# define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC +# define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +# define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD +# define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE +# define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B +# define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +# define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +# define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 +# define GL_LINES_ADJACENCY_EXT 0xA +# define GL_LINE_STRIP_ADJACENCY_EXT 0xB +# define GL_TRIANGLES_ADJACENCY_EXT 0xC +# define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0xD +# define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +# define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 +# define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +# define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 +# define GL_PROGRAM_POINT_SIZE_EXT 0x8642 +#endif + +#if !defined(QT_OPENGL_ES_2) +#define glProgramStringARB QGLContextPrivate::extensionFuncs(ctx).qt_glProgramStringARB +#define glBindProgramARB QGLContextPrivate::extensionFuncs(ctx).qt_glBindProgramARB +#define glDeleteProgramsARB QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteProgramsARB +#define glGenProgramsARB QGLContextPrivate::extensionFuncs(ctx).qt_glGenProgramsARB +#define glProgramLocalParameter4fvARB QGLContextPrivate::extensionFuncs(ctx).qt_glProgramLocalParameter4fvARB + +#define glActiveStencilFaceEXT QGLContextPrivate::extensionFuncs(ctx).qt_glActiveStencilFaceEXT + +#define glMultiTexCoord4f QGLContextPrivate::extensionFuncs(ctx).qt_glMultiTexCoord4f + +#define glActiveTexture QGLContextPrivate::extensionFuncs(ctx).qt_glActiveTexture +#endif // !defined(QT_OPENGL_ES_2) + + +// FBOs +#if !defined(QT_OPENGL_ES_2) +#define glIsRenderbuffer QGLContextPrivate::extensionFuncs(ctx).qt_glIsRenderbuffer +#define glBindRenderbuffer QGLContextPrivate::extensionFuncs(ctx).qt_glBindRenderbuffer +#define glDeleteRenderbuffers QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteRenderbuffers +#define glGenRenderbuffers QGLContextPrivate::extensionFuncs(ctx).qt_glGenRenderbuffers +#define glRenderbufferStorage QGLContextPrivate::extensionFuncs(ctx).qt_glRenderbufferStorage +#define glGetRenderbufferParameteriv QGLContextPrivate::extensionFuncs(ctx).qt_glGetRenderbufferParameteriv +#define glIsFramebuffer QGLContextPrivate::extensionFuncs(ctx).qt_glIsFramebuffer +#define glBindFramebuffer QGLContextPrivate::extensionFuncs(ctx).qt_glBindFramebuffer +#define glDeleteFramebuffers QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteFramebuffers +#define glGenFramebuffers QGLContextPrivate::extensionFuncs(ctx).qt_glGenFramebuffers +#define glCheckFramebufferStatus QGLContextPrivate::extensionFuncs(ctx).qt_glCheckFramebufferStatus +#define glFramebufferTexture2D QGLContextPrivate::extensionFuncs(ctx).qt_glFramebufferTexture2D +#define glFramebufferRenderbuffer QGLContextPrivate::extensionFuncs(ctx).qt_glFramebufferRenderbuffer +#define glGetFramebufferAttachmentParameteriv QGLContextPrivate::extensionFuncs(ctx).qt_glGetFramebufferAttachmentParameteriv +#define glGenerateMipmap QGLContextPrivate::extensionFuncs(ctx).qt_glGenerateMipmap +#endif // QT_OPENGL_ES_2 +#define glBlitFramebufferEXT QGLContextPrivate::extensionFuncs(ctx).qt_glBlitFramebufferEXT +#define glRenderbufferStorageMultisampleEXT QGLContextPrivate::extensionFuncs(ctx).qt_glRenderbufferStorageMultisampleEXT + + +// Buffer objects +#if defined(QGL_RESOLVE_BUFFER_FUNCS) +#define glBindBuffer QGLContextPrivate::extensionFuncs(ctx).qt_glBindBuffer +#define glDeleteBuffers QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteBuffers +#define glGenBuffers QGLContextPrivate::extensionFuncs(ctx).qt_glGenBuffers +#define glBufferData QGLContextPrivate::extensionFuncs(ctx).qt_glBufferData +#define glBufferSubData QGLContextPrivate::extensionFuncs(ctx).qt_glBufferSubData +#define glGetBufferSubData QGLContextPrivate::extensionFuncs(ctx).qt_glGetBufferSubData +#define glGetBufferParameteriv QGLContextPrivate::extensionFuncs(ctx).qt_glGetBufferParameteriv +#endif +#define glMapBufferARB QGLContextPrivate::extensionFuncs(ctx).qt_glMapBufferARB +#define glUnmapBufferARB QGLContextPrivate::extensionFuncs(ctx).qt_glUnmapBufferARB + + +// GLSL +#if !defined(QT_OPENGL_ES_2) + +#define glCreateShader QGLContextPrivate::extensionFuncs(ctx).qt_glCreateShader +#define glShaderSource QGLContextPrivate::extensionFuncs(ctx).qt_glShaderSource +#define glShaderBinary QGLContextPrivate::extensionFuncs(ctx).qt_glShaderBinary +#define glCompileShader QGLContextPrivate::extensionFuncs(ctx).qt_glCompileShader +#define glDeleteShader QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteShader +#define glIsShader QGLContextPrivate::extensionFuncs(ctx).qt_glIsShader + +#define glCreateProgram QGLContextPrivate::extensionFuncs(ctx).qt_glCreateProgram +#define glAttachShader QGLContextPrivate::extensionFuncs(ctx).qt_glAttachShader +#define glDetachShader QGLContextPrivate::extensionFuncs(ctx).qt_glDetachShader +#define glLinkProgram QGLContextPrivate::extensionFuncs(ctx).qt_glLinkProgram +#define glUseProgram QGLContextPrivate::extensionFuncs(ctx).qt_glUseProgram +#define glDeleteProgram QGLContextPrivate::extensionFuncs(ctx).qt_glDeleteProgram +#define glIsProgram QGLContextPrivate::extensionFuncs(ctx).qt_glIsProgram + +#define glGetShaderInfoLog QGLContextPrivate::extensionFuncs(ctx).qt_glGetShaderInfoLog +#define glGetShaderiv QGLContextPrivate::extensionFuncs(ctx).qt_glGetShaderiv +#define glGetShaderSource QGLContextPrivate::extensionFuncs(ctx).qt_glGetShaderSource +#define glGetProgramiv QGLContextPrivate::extensionFuncs(ctx).qt_glGetProgramiv +#define glGetProgramInfoLog QGLContextPrivate::extensionFuncs(ctx).qt_glGetProgramInfoLog + +#define glGetUniformLocation QGLContextPrivate::extensionFuncs(ctx).qt_glGetUniformLocation +#define glUniform4fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniform4fv +#define glUniform3fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniform3fv +#define glUniform2fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniform2fv +#define glUniform1fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniform1fv +#define glUniform1i QGLContextPrivate::extensionFuncs(ctx).qt_glUniform1i +#define glUniform1iv QGLContextPrivate::extensionFuncs(ctx).qt_glUniform1iv +#define glUniformMatrix2fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix2fv +#define glUniformMatrix3fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix3fv +#define glUniformMatrix4fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix4fv +#define glUniformMatrix2x3fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix2x3fv +#define glUniformMatrix2x4fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix2x4fv +#define glUniformMatrix3x2fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix3x2fv +#define glUniformMatrix3x4fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix3x4fv +#define glUniformMatrix4x2fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix4x2fv +#define glUniformMatrix4x3fv QGLContextPrivate::extensionFuncs(ctx).qt_glUniformMatrix4x3fv + +#define glBindAttribLocation QGLContextPrivate::extensionFuncs(ctx).qt_glBindAttribLocation +#define glGetAttribLocation QGLContextPrivate::extensionFuncs(ctx).qt_glGetAttribLocation +#define glVertexAttrib1fv QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttrib1fv +#define glVertexAttrib2fv QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttrib2fv +#define glVertexAttrib3fv QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttrib3fv +#define glVertexAttrib4fv QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttrib4fv +#define glVertexAttribPointer QGLContextPrivate::extensionFuncs(ctx).qt_glVertexAttribPointer +#define glDisableVertexAttribArray QGLContextPrivate::extensionFuncs(ctx).qt_glDisableVertexAttribArray +#define glEnableVertexAttribArray QGLContextPrivate::extensionFuncs(ctx).qt_glEnableVertexAttribArray + +#else // QT_OPENGL_ES_2 + +#define glGetProgramBinaryOES QGLContextPrivate::extensionFuncs(ctx).qt_glGetProgramBinaryOES +#define glProgramBinaryOES QGLContextPrivate::extensionFuncs(ctx).qt_glProgramBinaryOES + +#endif // QT_OPENGL_ES_2 + + +#if !defined(QT_OPENGL_ES_2) +#define glStencilOpSeparate QGLContextPrivate::extensionFuncs(ctx).qt_glStencilOpSeparate +#define glBlendColor QGLContextPrivate::extensionFuncs(ctx).qt_glBlendColor +#endif + +#if defined(QT_OPENGL_ES_2) +#define glClearDepth glClearDepthf +#endif + +#define glProgramParameteriEXT QGLContextPrivate::extensionFuncs(ctx).qt_glProgramParameteriEXT +#define glFramebufferTextureEXT QGLContextPrivate::extensionFuncs(ctx).qt_glFramebufferTextureEXT +#define glFramebufferTextureLayerEXT QGLContextPrivate::extensionFuncs(ctx).qt_glFramebufferTextureLayerEXT +#define glFramebufferTextureFaceEXT QGLContextPrivate::extensionFuncs(ctx).qt_glFramebufferTextureFaceEXT + +#if !defined(QT_OPENGL_ES) +#define glCompressedTexImage2D QGLContextPrivate::extensionFuncs(ctx).qt_glCompressedTexImage2DARB +#endif + +#ifndef QT_NO_EGL +// OES_EGL_image +#define glEGLImageTargetTexture2DOES QGLContextPrivate::extensionFuncs(ctx).qt_glEGLImageTargetTexture2DOES +#define glEGLImageTargetRenderbufferStorageOES QGLContextPrivate::extensionFuncs(ctx).qt_glEGLImageTargetRenderbufferStorageOES +#endif + +extern bool qt_resolve_framebufferobject_extensions(QGLContext *ctx); +bool qt_resolve_buffer_extensions(QGLContext *ctx); + +bool qt_resolve_version_1_3_functions(QGLContext *ctx); +bool qt_resolve_version_2_0_functions(QGLContext *ctx); +bool qt_resolve_stencil_face_extension(QGLContext *ctx); +bool qt_resolve_frag_program_extensions(QGLContext *ctx); + +bool qt_resolve_glsl_extensions(QGLContext *ctx); + +#ifndef QT_NO_EGL +Q_OPENGL_EXPORT bool qt_resolve_eglimage_gl_extensions(QGLContext *ctx); +#endif + +QT_END_NAMESPACE + +#endif // QGL_EXTENSIONS_P_H diff --git a/src/quick3d/qdeclarativeeffect.cpp b/src/quick3d/qdeclarativeeffect.cpp index c0b9c9d21..de059834d 100644 --- a/src/quick3d/qdeclarativeeffect.cpp +++ b/src/quick3d/qdeclarativeeffect.cpp @@ -49,7 +49,6 @@ #include <QtDeclarative/qdeclarativeengine.h> -#include "private/qdeclarativepixmapcache_p.h" #include <qdeclarativeinfo.h> /*! @@ -92,7 +91,6 @@ public: blending(false), texture2D(0), material(0), - declarativePixmap(), progress(0.0) { } @@ -110,8 +108,6 @@ public: QGLTexture2D *texture2D; QUrl textureUrl; QGLMaterial *material; - - QDeclarativePixmap declarativePixmap; qreal progress; }; @@ -227,6 +223,9 @@ void QDeclarativeEffect::setBlending(bool value) Textures can also be defined directly as images using the textureImage property. + If the value is non-empty, and the texture could not be loaded from + the QUrl for any reason, then the property will not be changed. + \sa textureImage */ QUrl QDeclarativeEffect::texture() const @@ -239,94 +238,65 @@ void QDeclarativeEffect::setTexture(const QUrl& value) if (d->textureUrl == value) return; - d->textureUrl = value; - // got a new value, so abort any in-progress request - d->declarativePixmap.clear(this); - if (d->progress != 0.0) { d->progress = 0.0; emit progressChanged(d->progress); } - if (d->textureUrl.isEmpty()) + if (value.isEmpty()) { - d->textureChanged = true; + d->textureUrl = value; + delete d->texture2D; + d->texture2D = 0; } else { - // Start loading the new texture - d->textureUrl = value; - emit effectChanged(); - - bool async(true); -#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML - async = d->textureUrl.scheme() != QLatin1String("file"); -#endif -#if QT_VERSION >= 0x040702 - QDeclarativePixmap::Options options = QDeclarativePixmap::Cache; - if (async) - options |= QDeclarativePixmap::Asynchronous; - d->declarativePixmap.load(qmlEngine(this), d->textureUrl, options); -#else - d->declarativePixmap.load(qmlEngine(this), d->textureUrl, async ); -#endif - if (d->declarativePixmap.isLoading()) + if (value.scheme() != QLatin1String("file")) { - d->declarativePixmap.connectFinished(this, SLOT(textureRequestFinished())); - d->declarativePixmap.connectDownloadProgress(this, SLOT(textureRequestProgress(qint64,qint64))); + // TODO - support network URL's for loading - note that this feature is for + // the Qt3D 1.1 release and there is no point in implementing it until for example + // model loading and all other parts of Qt3D support it. Also when it is implemented + // it has to be done with a facility that does not depend on private headers in + // QtDeclarative which can change within minor dot-point releases. + qWarning("Network URL's not yet supported - %s", qPrintable(d->textureUrl.toString())); } else { - if (d->declarativePixmap.isError()) - qWarning() << "Error loading pixmap: " << d->declarativePixmap.error(); - else if (d->declarativePixmap.isReady()) + // Load the new texture + QString localFile = d->textureUrl.toLocalFile(); + if (localFile.endsWith(QLatin1String(".dds"))) { - textureRequestFinished(); + QGLTexture2D *tex = new QGLTexture2D; + bool valid = tex->setCompressedFile(localFile); + if (!valid) + { + delete tex; + } + else + { + delete d->texture2D; + d->texture2D = tex; + } + } + else + { + QImage im(localFile); + if (im.isNull()) + { + qWarning("Could not load image from local file path - %s", qPrintable(localFile)); + } + else + { + setTextureImage(im); + emit effectChanged(); + } } } } } /*! - This function is used to emit the appropriate signal when the texture request has finished. - - \sa effectChanged() -*/ -void QDeclarativeEffect::textureRequestFinished() -{ - QDeclarativePixmap::Status status = d->declarativePixmap.status(); - d->textureChanged = true; - if (status == QDeclarativePixmap::Ready) - { - setTextureImage(d->declarativePixmap.pixmap().toImage()); - if (d->declarativePixmap.pixmap().isNull() ) { - qWarning() << "Could not load specified texture file"; - } - d->progress = 1.0; - emit progressChanged(d->progress); - emit effectChanged(); - } else if (status != QDeclarativePixmap::Loading) - { - qWarning() << "Error getting texture image from cache: " - << d->declarativePixmap.error(); - } -} - -/*! - Updates the progress of an asynchronous resource request. Progress is - simply \a received / \a total. -*/ -void QDeclarativeEffect::textureRequestProgress(qint64 received, qint64 total) -{ - if (d->declarativePixmap.status() == QDeclarativePixmap::Loading && total > 0) { - d->progress = qreal(received)/total; - emit progressChanged(d->progress); - } -} - - -/*! \qmlproperty image Effect::textureImage This property directly defines a texture using an existing QImage. @@ -337,8 +307,7 @@ void QDeclarativeEffect::textureRequestProgress(qint64 received, qint64 total) */ QImage QDeclarativeEffect::textureImage() const { - // Expensive - return d->declarativePixmap.pixmap().toImage(); + return d->texture2D->image(); } /*! @@ -347,7 +316,9 @@ QImage QDeclarativeEffect::textureImage() const */ void QDeclarativeEffect::setTextureImage(const QImage& value) { - d->declarativePixmap.setPixmap(QPixmap::fromImage(value)); + if (d->texture2D == NULL) + d->texture2D = new QGLTexture2D; + d->texture2D->setImage(value); d->textureChanged = true; emit effectChanged(); } @@ -395,7 +366,7 @@ void QDeclarativeEffect::setMaterial(QGLMaterial *value) */ void QDeclarativeEffect::enableEffect(QGLPainter *painter) { - QGLTexture2D *tex = texture2D(); + QGLTexture2D *tex = d->texture2D; if (tex == NULL && d->material) tex = d->material->texture(); if (d->useLighting) { @@ -441,6 +412,11 @@ void QDeclarativeEffect::disableEffect(QGLPainter *painter) glBindTexture(GL_TEXTURE_2D, 0); } +QGLTexture2D *QDeclarativeEffect::texture2D() +{ + return d->texture2D; +} + /*! Returns the progress of remote resource loading. */ @@ -449,21 +425,4 @@ qreal QDeclarativeEffect::progress() return d->progress; } -/*! - \internal - This function returns a \l QGLTexture2D based on the \c texture property of the \l Effect. -*/ -QGLTexture2D *QDeclarativeEffect::texture2D() -{ - if (d->textureChanged) { - delete d->texture2D; - QGLTexture2D *newtex = new QGLTexture2D(); - if (!d->declarativePixmap.pixmap().isNull()) - newtex->setPixmap(d->declarativePixmap.pixmap()); - d->texture2D = newtex; - d->textureChanged = false; - } - return d->texture2D; -} - QT_END_NAMESPACE diff --git a/src/quick3d/qdeclarativeeffect.h b/src/quick3d/qdeclarativeeffect.h index be843f7a7..50a03c263 100644 --- a/src/quick3d/qdeclarativeeffect.h +++ b/src/quick3d/qdeclarativeeffect.h @@ -56,6 +56,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(QtQuick3D) + class QDeclarativeEffectPrivate; class QGLPainter; class QGLMaterial; @@ -105,9 +107,6 @@ Q_SIGNALS: void effectChanged(); void progressChanged(qreal progress); -protected Q_SLOTS: - virtual void textureRequestFinished(); - virtual void textureRequestProgress(qint64 recieived, qint64 total); protected: QGLTexture2D *texture2D(); diff --git a/src/quick3d/qdeclarativeitem3d.cpp b/src/quick3d/qdeclarativeitem3d.cpp index 1ddad6ff2..52b8de6a0 100644 --- a/src/quick3d/qdeclarativeitem3d.cpp +++ b/src/quick3d/qdeclarativeitem3d.cpp @@ -53,12 +53,6 @@ #include <QtGui/qevent.h> #include <QtDeclarative/qdeclarativecontext.h> -// Hack to prevent inclusion of <private/qdeclarativestate_p.h> -// which creates problems with undefined symbols under Windows. -// We only need the definition of QDeclarativeStateGroup. -#define QDECLARATIVESTATE_H - -#include <QtDeclarative/private/qdeclarativestategroup_p.h> /*! \qmlclass Item3D QDeclarativeItem3D @@ -250,7 +244,6 @@ public: , objectPickId(-1) , cullFaces(QDeclarativeItem3D::CullDisabled) , sortChildren(QDeclarativeItem3D::DefaultSorting) - , _stateGroup(0) , inheritEvents(false) , isEnabled(true) , isInitialized(false) @@ -273,8 +266,6 @@ public: int objectPickId; QDeclarativeItem3D::CullFaces cullFaces; QDeclarativeItem3D::SortMode sortChildren; - QDeclarativeStateGroup *states(); - QDeclarativeStateGroup *_stateGroup; QList<QDeclarativeItem3D *> children; bool inheritEvents; @@ -518,24 +509,11 @@ QMatrix4x4 QDeclarativeItem3DPrivate::localTransforms() const } - -QDeclarativeStateGroup *QDeclarativeItem3DPrivate::states() -{ - if (!_stateGroup) { - _stateGroup = new QDeclarativeStateGroup(item); - QObject::connect(_stateGroup, SIGNAL(stateChanged(QString)), - item, SIGNAL(stateChanged(QString))); - } - - return _stateGroup; -} - - /*! \internal */ QDeclarativeItem3D::QDeclarativeItem3D(QObject *parent) - : QObject(parent) + : QDeclarativeItem(0) { d = new QDeclarativeItem3DPrivate(this); QDeclarativeItem3D *itemParent = qobject_cast<QDeclarativeItem3D *>(parent); @@ -964,72 +942,6 @@ QDeclarativeListProperty<QObject> QDeclarativeItem3D::data() } /*! - \qmlproperty list<State> Item3D::states - - QML allows users to define any number of states for objects, including \l Item3D objects. - These states are arbitrarily assigned and can be used to represent anything the user desires. - An \l Item3D representing a door, for example, may have an \i "open" and \i "closed" state. - - States can be connected by transitions, which define an animation or other transitional change - which occurs during the change from one state to another. In our open and closed door state, - for example, the transition may define the rotation of the opening door when it swings open and - swings back closed. - - By default the list of valid states for the item is empty. - - \sa state, transitions -*/ -QDeclarativeListProperty<QDeclarativeState> QDeclarativeItem3D::states() -{ - return d->states()->statesProperty(); -} - -/*! - \qmlproperty list<Transition> Item3D::transitions - - When an object in QML moves from one state to another its behavior during this - change can be defined using transitions. These transitions may define changes to one or - more objects or properties, and may include animations such as rotations, scaling, - translation, and so on. - - Users can define a set of transitional procedures using this property. - - As with states, by default there are no transitions defined. - - \sa state, states -*/ -QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItem3D::transitions() -{ - return d->states()->transitionsProperty(); -} - - -/*! - \qmlproperty string Item3D::state - - This property describes the current state of the \l Item3D as defined in the list of - allowable states for this item. - - By default an item's state is undefined and irrelevant. It is only when the states property - has been modified that a current state makes any sense. - - \sa states -*/ - -QString QDeclarativeItem3D::state() const -{ - if (!d->_stateGroup) - return QString(); - else - return d->_stateGroup->state(); -} - -void QDeclarativeItem3D::setState(const QString &state) -{ - d->states()->setState(state); -} - -/*! \qmlproperty Item3D Item3D::parent This property specifies the Item3D parent of this item, @@ -1301,22 +1213,6 @@ void QDeclarativeItem3D::initialize(QGLPainter *painter) /*! \internal -*/ -void QDeclarativeItem3D::classBegin() -{ - d->states()->classBegin(); -} - -/*! - \internal -*/ -void QDeclarativeItem3D::componentComplete() -{ - d->states()->componentComplete(); -} - -/*! - \internal The \c drawItem function performs the actual drawing of the mesh branch which corresponds to the section of the mesh being drawn by the \l Item3D to a specific \a painter. */ diff --git a/src/quick3d/qdeclarativeitem3d.h b/src/quick3d/qdeclarativeitem3d.h index a73eeed72..773388242 100644 --- a/src/quick3d/qdeclarativeitem3d.h +++ b/src/quick3d/qdeclarativeitem3d.h @@ -47,9 +47,8 @@ #include <QtCore/qobject.h> #include <QtCore/qvariant.h> #include <QtGui/qvector3d.h> -#include <QtDeclarative/qdeclarative.h> -#include <QtDeclarative/qdeclarativelist.h> -#include <QtDeclarative/qdeclarativeparserstatus.h> + +#include <QtDeclarative/qdeclarativeitem.h> #include "qglscenenode.h" #include "qglpainter.h" @@ -66,7 +65,7 @@ class QDeclarativeViewport; class QDeclarativeState; class QDeclarativeTransition; -class Q_QT3D_QUICK_EXPORT QDeclarativeItem3D : public QObject, public QDeclarativeParserStatus +class Q_QT3D_QUICK_EXPORT QDeclarativeItem3D : public QDeclarativeItem { Q_OBJECT Q_INTERFACES(QDeclarativeParserStatus) @@ -86,9 +85,6 @@ class Q_QT3D_QUICK_EXPORT QDeclarativeItem3D : public QObject, public QDeclarati Q_PROPERTY(QDeclarativeListProperty<QObject> resources READ resources DESIGNABLE false) Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data DESIGNABLE false) Q_PROPERTY(QDeclarativeListProperty<QDeclarativeItem3D> children READ itemChildren DESIGNABLE false NOTIFY childrenChanged) - Q_PROPERTY(QDeclarativeListProperty<QDeclarativeState> states READ states DESIGNABLE false) - Q_PROPERTY(QDeclarativeListProperty<QDeclarativeTransition> transitions READ transitions DESIGNABLE false) - Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) Q_PROPERTY(CullFaces cullFaces READ cullFaces WRITE setCullFaces NOTIFY meshChanged) Q_PROPERTY(SortMode sortChildren READ sortChildren WRITE setSortChildren NOTIFY sortChildrenChanged) Q_PROPERTY(QString meshNode READ meshNode WRITE setMeshNode NOTIFY meshNodeChanged) @@ -151,13 +147,6 @@ public: QDeclarativeListProperty<QGraphicsTransform3D> transform(); QDeclarativeListProperty<QGraphicsTransform3D> pretransform(); - QDeclarativeListProperty<QDeclarativeState> states(); - - QDeclarativeListProperty<QDeclarativeTransition> transitions(); - - QString state() const; - void setState(const QString &); - CullFaces cullFaces() const; void setCullFaces(CullFaces value); @@ -173,9 +162,6 @@ public: virtual void draw(QGLPainter *painter); virtual void initialize(QGLPainter *painter); - void classBegin(); - void componentComplete(); - Q_INVOKABLE QVector3D localToWorld(const QVector3D &point = QVector3D()) const; Q_INVOKABLE QVector3D worldToLocal(const QVector3D &point = QVector3D()) const; diff --git a/src/quick3d/qdeclarativemesh.h b/src/quick3d/qdeclarativemesh.h index ac6e9c53f..2311c77d0 100644 --- a/src/quick3d/qdeclarativemesh.h +++ b/src/quick3d/qdeclarativemesh.h @@ -68,6 +68,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(QtQuick3D) + class QDeclarativeMeshPrivate; class QGLAbstractScene; class QGLMaterial; diff --git a/src/quick3d/qdeclarativeviewport.h b/src/quick3d/qdeclarativeviewport.h index 1a1d6310b..2534130aa 100644 --- a/src/quick3d/qdeclarativeviewport.h +++ b/src/quick3d/qdeclarativeviewport.h @@ -60,6 +60,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(QtQuick3D) + class QDeclarativeItem3D; // Abstract interface for "Item3D" getting access to the "Viewport" diff --git a/src/quick3d/qsgpretransformnode.h b/src/quick3d/qsgpretransformnode.h index b7c4af704..251072e97 100644 --- a/src/quick3d/qsgpretransformnode.h +++ b/src/quick3d/qsgpretransformnode.h @@ -49,6 +49,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(QtQuick3D) + class Q_QT3D_QUICK_EXPORT QSGPreTransformNode : public TransformNode { public: diff --git a/src/quick3d/qt3dquickglobal.h b/src/quick3d/qt3dquickglobal.h index c50e91adc..7c751b593 100644 --- a/src/quick3d/qt3dquickglobal.h +++ b/src/quick3d/qt3dquickglobal.h @@ -44,7 +44,7 @@ #include <QtCore/qglobal.h> -QT_LICENSED_MODULE(Qt3DQuick) +QT_LICENSED_MODULE(QtQuick3D) #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) # if defined(QT_NODLL) # undef QT_MAKEDLL diff --git a/src/quick3d/quick3d.pro b/src/quick3d/quick3d.pro index ec4d699eb..eb175366e 100644 --- a/src/quick3d/quick3d.pro +++ b/src/quick3d/quick3d.pro @@ -30,6 +30,8 @@ symbian { } } +include(../private/private.pri) + include(quick3d.pri) PUBLIC_HEADERS = $$HEADERS @@ -53,6 +55,7 @@ for(hdr, PUBLIC_HEADERS) { # as well. Other OS's, or mac without frameworks, install the headers into # the Qt build tree directly. macx:CONFIG(qt_framework, qt_framework|qt_no_framework) { + QMAKE_LFLAGS_SONAME = -Wl,-install_name,$$DESTDIR/ CONFIG += lib_bundle FRAMEWORK_HEADERS.version = Versions FRAMEWORK_HEADERS.path = Headers diff --git a/src/threed/painting/qglext.cpp b/src/threed/painting/qglext.cpp index 0618d79e4..2e68f7a27 100644 --- a/src/threed/painting/qglext.cpp +++ b/src/threed/painting/qglext.cpp @@ -42,7 +42,8 @@ #include "qglext_p.h" #include "qopenglfunctions.h" -#include <QtOpenGL/private/qglextensions_p.h> +// copied private header +#include "qglextensions_p.h" QT_BEGIN_NAMESPACE diff --git a/src/threed/scene/qglabstractscene.cpp b/src/threed/scene/qglabstractscene.cpp index 5573cf246..28fbd053b 100644 --- a/src/threed/scene/qglabstractscene.cpp +++ b/src/threed/scene/qglabstractscene.cpp @@ -43,9 +43,11 @@ #include "qglsceneformatplugin.h" #include "qglpicknode.h" +// copied private header +#include "qfactoryloader_p.h" + #include <QtCore/qfile.h> #include <QtCore/qfileinfo.h> -//#include <QtCore/private/qfactoryloader_p.h> #include <QtCore/qlibraryinfo.h> #include <QtNetwork/qnetworkreply.h> #include <QtCore/qcoreevent.h> diff --git a/src/threed/threed.pro b/src/threed/threed.pro index d4e908f5f..4f899da20 100644 --- a/src/threed/threed.pro +++ b/src/threed/threed.pro @@ -48,11 +48,15 @@ for(hdr, PUBLIC_HEADERS) { INSTALL_HEADERS += $$found_vdir/$$hdr } + +# -install_name /Users/sarasmit/build/qt/qt-qml/lib/QtOpenGL.framework/Versions/4/QtOpenGL + # If Qt has been configured to build frameworks, then the build will put # the Qt3D library into a framework bundle, so put the headers in the bundle # as well. Other OS's, or mac without frameworks, install the headers into # the Qt build tree directly. macx:CONFIG(qt_framework, qt_framework|qt_no_framework) { + QMAKE_LFLAGS_SONAME = -Wl,-install_name,$$DESTDIR/ CONFIG += lib_bundle FRAMEWORK_HEADERS.version = Versions FRAMEWORK_HEADERS.path = Headers |