diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2010-11-24 09:09:51 +0100 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@nokia.com> | 2010-11-24 09:09:51 +0100 |
commit | 4051ce1e107034d1d17a4acf2c9a393cdbea028d (patch) | |
tree | f48f5ee894ea357c59e7ccb2c5d3ca8ba61745e4 | |
parent | 5ca7e1aea44ea92a44e41041de868270d06480db (diff) |
Remove qglext.h/cpp now that we have QGLFunctions in Qt
-rw-r--r-- | src/effects/shadereffectitem.cpp | 5 | ||||
-rw-r--r-- | src/scenegraph/3d/qglext.cpp | 277 | ||||
-rw-r--r-- | src/scenegraph/3d/qglext.h | 179 | ||||
-rw-r--r-- | src/scenegraph/coreapi/renderer.cpp | 11 | ||||
-rw-r--r-- | src/scenegraph/coreapi/renderer.h | 2 | ||||
-rw-r--r-- | src/scenegraph/scenegraph.pri | 5 |
6 files changed, 8 insertions, 471 deletions
diff --git a/src/effects/shadereffectitem.cpp b/src/effects/shadereffectitem.cpp index 4b85c93..8d802df 100644 --- a/src/effects/shadereffectitem.cpp +++ b/src/effects/shadereffectitem.cpp @@ -44,7 +44,6 @@ #include "utilities.h" #include "material.h" #include "qxitem_p.h" -#include "qglext.h" #include "adaptationlayer.h" @@ -103,7 +102,7 @@ void CustomShaderMaterialData::updateRendererState(Renderer *renderer, Renderer: q->m_program.setUniformValue("qt_Matrix", renderer->combinedMatrix()); } -void CustomShaderMaterialData::updateEffectState(Renderer *, AbstractEffect *newEffect, AbstractEffect *oldEffect) +void CustomShaderMaterialData::updateEffectState(Renderer *r, AbstractEffect *newEffect, AbstractEffect *oldEffect) { Q_ASSERT(oldEffect == 0); Q_ASSERT(newEffect == static_cast<AbstractEffect *>(q)); @@ -112,7 +111,7 @@ void CustomShaderMaterialData::updateEffectState(Renderer *, AbstractEffect *new GLint filtering = q->m_linear_filtering ? GL_LINEAR : GL_NEAREST; for (int i = q->m_sources.size() - 1; i >= 0; --i) { - qt_gl_ActiveTexture(GL_TEXTURE0 + i); + r->glActiveTexture(GL_TEXTURE0 + i); #if !defined(QT_OPENGL_ES_2) glEnable(GL_TEXTURE_2D); #endif diff --git a/src/scenegraph/3d/qglext.cpp b/src/scenegraph/3d/qglext.cpp deleted file mode 100644 index e1eba22..0000000 --- a/src/scenegraph/3d/qglext.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/**************************************************************************** -** -** 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 Qt scene graph research project. -** -** $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 "qglext.h" -#include <QtOpenGL/private/qgl_p.h> - -QT_BEGIN_NAMESPACE - -#if !defined(QT_OPENGL_ES) - -typedef void (APIENTRY *q_PFNGLACTIVETEXTUREPROC) (GLenum); -typedef void (APIENTRY *q_PFNGLCLIENTACTIVETEXTUREPROC) (GLenum); - -class QGLMultiTextureExtensions -{ -public: - QGLMultiTextureExtensions(const QGLContext * = 0) - { - activeTexture = 0; - clientActiveTexture = 0; - multiTextureResolved = false; - } - - q_PFNGLACTIVETEXTUREPROC activeTexture; - q_PFNGLCLIENTACTIVETEXTUREPROC clientActiveTexture; - bool multiTextureResolved; -}; - -#if QT_VERSION >= 0x040800 -Q_GLOBAL_STATIC(QGLContextGroupResource<QGLMultiTextureExtensions>, qt_multitexture_funcs) -#else -static void qt_multitexture_funcs_free(void *data) -{ - delete reinterpret_cast<QGLMultiTextureExtensions *>(data); -} - -Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_multitexture_funcs, (qt_multitexture_funcs_free)) -#endif - -static QGLMultiTextureExtensions *resolveMultiTextureExtensions - (const QGLContext *ctx) -{ - QGLMultiTextureExtensions *extn = - reinterpret_cast<QGLMultiTextureExtensions *> - (qt_multitexture_funcs()->value(ctx)); - if (!extn) { - extn = new QGLMultiTextureExtensions(); - qt_multitexture_funcs()->insert(ctx, extn); - } - if (!(extn->multiTextureResolved)) { - extn->multiTextureResolved = true; - if (!extn->activeTexture) { - extn->activeTexture = (q_PFNGLACTIVETEXTUREPROC) - ctx->getProcAddress(QLatin1String("glActiveTexture")); - } - if (!extn->activeTexture) { - extn->activeTexture = (q_PFNGLACTIVETEXTUREPROC) - ctx->getProcAddress(QLatin1String("glActiveTextureARB")); - } - if (!extn->clientActiveTexture) { - extn->clientActiveTexture = (q_PFNGLCLIENTACTIVETEXTUREPROC) - ctx->getProcAddress(QLatin1String("glClientActiveTexture")); - } - if (!extn->clientActiveTexture) { - extn->clientActiveTexture = (q_PFNGLCLIENTACTIVETEXTUREPROC) - ctx->getProcAddress(QLatin1String("glClientActiveTextureARB")); - } - } - return extn; -} - -void qt_gl_ClientActiveTexture(GLenum texture) -{ - const QGLContext *ctx = QGLContext::currentContext(); - if (!ctx) - return; - QGLMultiTextureExtensions *extn = resolveMultiTextureExtensions(ctx); - if (extn->clientActiveTexture) - extn->clientActiveTexture(texture); -} - -void qt_gl_ActiveTexture(GLenum texture) -{ - const QGLContext *ctx = QGLContext::currentContext(); - if (!ctx) - return; - QGLMultiTextureExtensions *extn = resolveMultiTextureExtensions(ctx); - if (extn->activeTexture) - extn->activeTexture(texture); -} - -#endif - -#if !defined(QT_OPENGL_ES_2) - -typedef void (APIENTRY *q_PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -typedef void (APIENTRY *q_PFNGLBLENDEQUATIONPROC) (GLenum mode); -typedef void (APIENTRY *q_PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (APIENTRY *q_PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); - -class QGLBlendExtensions -{ -public: - QGLBlendExtensions(const QGLContext * = 0) - { - blendColor = 0; - blendFuncSeparate = 0; - blendEquation = 0; - blendEquationSeparate = 0; - blendResolved = false; - } - - q_PFNGLBLENDCOLORPROC blendColor; - q_PFNGLBLENDFUNCSEPARATEPROC blendFuncSeparate; - q_PFNGLBLENDEQUATIONPROC blendEquation; - q_PFNGLBLENDEQUATIONSEPARATEPROC blendEquationSeparate; - bool blendResolved; -}; - -#if QT_VERSION >= 0x040800 -Q_GLOBAL_STATIC(QGLContextGroupResource<QGLBlendExtensions>, qt_blend_funcs) -#else -static void qt_blend_funcs_free(void *data) -{ - delete reinterpret_cast<QGLBlendExtensions *>(data); -} - -Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_blend_funcs, (qt_blend_funcs_free)) -#endif - -static QGLBlendExtensions *resolveBlendExtensions(const QGLContext *ctx) -{ - QGLBlendExtensions *extn = - reinterpret_cast<QGLBlendExtensions *>(qt_blend_funcs()->value(ctx)); - if (!extn) { - extn = new QGLBlendExtensions(); - qt_blend_funcs()->insert(ctx, extn); - } - if (!(extn->blendResolved)) { - extn->blendResolved = true; - if (!extn->blendColor) { - extn->blendColor = (q_PFNGLBLENDCOLORPROC) - ctx->getProcAddress(QLatin1String("glBlendColorEXT")); - } - if (!extn->blendColor) { - extn->blendColor = (q_PFNGLBLENDCOLORPROC) - ctx->getProcAddress(QLatin1String("glBlendColorOES")); - } - if (!extn->blendColor) { - extn->blendColor = (q_PFNGLBLENDCOLORPROC) - ctx->getProcAddress(QLatin1String("glBlendColor")); - } - if (!extn->blendFuncSeparate) { - extn->blendFuncSeparate = (q_PFNGLBLENDFUNCSEPARATEPROC) - ctx->getProcAddress(QLatin1String("glBlendFuncSeparateEXT")); - } - if (!extn->blendFuncSeparate) { - extn->blendFuncSeparate = (q_PFNGLBLENDFUNCSEPARATEPROC) - ctx->getProcAddress(QLatin1String("glBlendFuncSeparateOES")); - } - if (!extn->blendFuncSeparate) { - extn->blendFuncSeparate = (q_PFNGLBLENDFUNCSEPARATEPROC) - ctx->getProcAddress(QLatin1String("glBlendFuncSeparate")); - } - if (!extn->blendEquation) { - extn->blendEquation = (q_PFNGLBLENDEQUATIONPROC) - ctx->getProcAddress(QLatin1String("glBlendEquationEXT")); - } - if (!extn->blendEquation) { - extn->blendEquation = (q_PFNGLBLENDEQUATIONPROC) - ctx->getProcAddress(QLatin1String("glBlendEquationOES")); - } - if (!extn->blendEquation) { - extn->blendEquation = (q_PFNGLBLENDEQUATIONPROC) - ctx->getProcAddress(QLatin1String("glBlendEquation")); - } - if (!extn->blendEquationSeparate) { - extn->blendEquationSeparate = (q_PFNGLBLENDEQUATIONSEPARATEPROC) - ctx->getProcAddress(QLatin1String("glBlendEquationSeparateEXT")); - } - if (!extn->blendEquationSeparate) { - extn->blendEquationSeparate = (q_PFNGLBLENDEQUATIONSEPARATEPROC) - ctx->getProcAddress(QLatin1String("glBlendEquationSeparateOES")); - } - if (!extn->blendEquationSeparate) { - extn->blendEquationSeparate = (q_PFNGLBLENDEQUATIONSEPARATEPROC) - ctx->getProcAddress(QLatin1String("glBlendEquationSeparate")); - } - } - return extn; -} - -void qt_gl_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) -{ - const QGLContext *ctx = QGLContext::currentContext(); - if (!ctx) - return; - QGLBlendExtensions *extn = resolveBlendExtensions(ctx); - if (extn->blendColor) - extn->blendColor(red, green, blue, alpha); -} - -void qt_gl_BlendEquation(GLenum mode) -{ - const QGLContext *ctx = QGLContext::currentContext(); - if (!ctx) - return; - QGLBlendExtensions *extn = resolveBlendExtensions(ctx); - if (extn->blendEquation) - extn->blendEquation(mode); -} - -void qt_gl_BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) -{ - const QGLContext *ctx = QGLContext::currentContext(); - if (!ctx) - return; - QGLBlendExtensions *extn = resolveBlendExtensions(ctx); - if (extn->blendEquationSeparate) - extn->blendEquationSeparate(modeRGB, modeAlpha); - else if (extn->blendEquation) - extn->blendEquation(modeRGB); // Do the best we can. -} - -void qt_gl_BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) -{ - const QGLContext *ctx = QGLContext::currentContext(); - if (!ctx) - return; - QGLBlendExtensions *extn = resolveBlendExtensions(ctx); - if (extn->blendFuncSeparate) - extn->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); - else - glBlendFunc(srcRGB, dstRGB); // Do the best we can. -} - -#endif - -QT_END_NAMESPACE diff --git a/src/scenegraph/3d/qglext.h b/src/scenegraph/3d/qglext.h deleted file mode 100644 index 7c46765..0000000 --- a/src/scenegraph/3d/qglext.h +++ /dev/null @@ -1,179 +0,0 @@ -/**************************************************************************** -** -** 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 Qt scene graph research project. -** -** $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 QGLEXT_H -#define QGLEXT_H - -#include <QtOpenGL/qgl.h> -#include "qt3dglobal.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -// Provide some useful OpenGL extension definitions. - -#if !defined(QT_OPENGL_ES) - -extern void Q_QT3D_EXPORT qt_gl_ClientActiveTexture(GLenum texture); -extern void Q_QT3D_EXPORT qt_gl_ActiveTexture(GLenum texture); - -#elif defined(QT_OPENGL_ES_2) - -#define qt_gl_ActiveTexture glActiveTexture - -#else - -#define qt_gl_ClientActiveTexture glClientActiveTexture -#define qt_gl_ActiveTexture glActiveTexture - -#endif - -#ifndef GL_TEXTURE0 -#define GL_TEXTURE0 0x84C0 -#endif -#ifndef GL_TEXTURE1 -#define GL_TEXTURE1 0x84C1 -#endif -#ifndef GL_TEXTURE2 -#define GL_TEXTURE2 0x84C2 -#endif -#ifndef GL_TEXTURE3 -#define GL_TEXTURE3 0x84C3 -#endif -#ifndef GL_TEXTURE4 -#define GL_TEXTURE4 0x84C4 -#endif -#ifndef GL_TEXTURE5 -#define GL_TEXTURE5 0x84C5 -#endif -#ifndef GL_TEXTURE6 -#define GL_TEXTURE6 0x84C6 -#endif -#ifndef GL_TEXTURE7 -#define GL_TEXTURE7 0x84C7 -#endif - -#if !defined(QT_OPENGL_ES_2) - -extern void Q_QT3D_EXPORT qt_gl_BlendColor(GLclampf, GLclampf, GLclampf, GLclampf); -extern void Q_QT3D_EXPORT qt_gl_BlendEquation(GLenum); -extern void Q_QT3D_EXPORT qt_gl_BlendEquationSeparate(GLenum, GLenum); -extern void Q_QT3D_EXPORT qt_gl_BlendFuncSeparate(GLenum, GLenum, GLenum, GLenum); - -#define qt_gl_BlendFunc glBlendFunc - -#else - -#define qt_gl_BlendColor glBlendColor -#define qt_gl_BlendEquation glBlendEquation -#define qt_gl_BlendEquationSeparate glBlendEquationSeparate -#define qt_gl_BlendFunc glBlendFunc -#define qt_gl_BlendFuncSeparate glBlendFuncSeparate - -#endif - -#ifndef GL_ZERO -#define GL_ZERO 0x0000 -#endif -#ifndef GL_ONE -#define GL_ONE 0x0001 -#endif -#ifndef GL_SRC_COLOR -#define GL_SRC_COLOR 0x0300 -#endif -#ifndef GL_ONE_MINUS_SRC_COLOR -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#endif -#ifndef GL_SRC_ALPHA -#define GL_SRC_ALPHA 0x0302 -#endif -#ifndef GL_ONE_MINUS_SRC_ALPHA -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#endif -#ifndef GL_DST_ALPHA -#define GL_DST_ALPHA 0x0304 -#endif -#ifndef GL_ONE_MINUS_DST_ALPHA -#define GL_ONE_MINUS_DST_ALPHA 0x0305 -#endif -#ifndef GL_DST_COLOR -#define GL_DST_COLOR 0x0306 -#endif -#ifndef GL_ONE_MINUS_DST_COLOR -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#endif -#ifndef GL_SRC_ALPHA_SATURATE -#define GL_SRC_ALPHA_SATURATE 0x0308 -#endif -#ifndef GL_CONSTANT_COLOR -#define GL_CONSTANT_COLOR 0x8001 -#endif -#ifndef GL_ONE_MINUS_CONSTANT_COLOR -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#endif -#ifndef GL_CONSTANT_ALPHA -#define GL_CONSTANT_ALPHA 0x8003 -#endif -#ifndef GL_ONE_MINUS_CONSTANT_ALPHA -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#endif -#ifndef GL_FUNC_ADD -#define GL_FUNC_ADD 0x8006 -#endif -#ifndef GL_MIN -#define GL_MIN 0x8007 -#endif -#ifndef GL_MAX -#define GL_MAX 0x8008 -#endif -#ifndef GL_FUNC_SUBTRACT -#define GL_FUNC_SUBTRACT 0x800A -#endif -#ifndef GL_FUNC_REVERSE_SUBTRACT -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#endif - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/scenegraph/coreapi/renderer.cpp b/src/scenegraph/coreapi/renderer.cpp index e082acb..39818d4 100644 --- a/src/scenegraph/coreapi/renderer.cpp +++ b/src/scenegraph/coreapi/renderer.cpp @@ -46,7 +46,6 @@ #include <qglattributevalue.h> #include <QGLShaderProgram> #include <qglframebufferobject.h> -#include <qglext.h> #include <QtGui/qapplication.h> //#define RENDERER_DEBUG @@ -144,21 +143,15 @@ void Renderer::setTexture(int unit, const QGLTexture2D *texture) return; // Select the texture unit and bind the texture. - qt_gl_ActiveTexture(GL_TEXTURE0 + unit); + glActiveTexture(GL_TEXTURE0 + unit); if (!texture) { glBindTexture(GL_TEXTURE_2D, 0); -#if !defined(QT_OPENGL_ES_2) - glDisable(GL_TEXTURE_2D); -#endif } else { const_cast<QGLTexture2D *>(texture)->bind(); -#if !defined(QT_OPENGL_ES_2) - glEnable(GL_TEXTURE_2D); -#endif } if (unit != 0) - qt_gl_ActiveTexture(GL_TEXTURE0); + glActiveTexture(GL_TEXTURE0); } AbstractEffectProgram *Renderer::prepareMaterial(AbstractEffect *material) diff --git a/src/scenegraph/coreapi/renderer.h b/src/scenegraph/coreapi/renderer.h index 1d9856f..78ee5cf 100644 --- a/src/scenegraph/coreapi/renderer.h +++ b/src/scenegraph/coreapi/renderer.h @@ -77,7 +77,7 @@ private: }; -class QT_SCENEGRAPH_EXPORT Renderer : public QObject, protected QGLFunctions +class QT_SCENEGRAPH_EXPORT Renderer : public QObject, public QGLFunctions { Q_OBJECT public: diff --git a/src/scenegraph/scenegraph.pri b/src/scenegraph/scenegraph.pri index 6317c8f..cde79fe 100644 --- a/src/scenegraph/scenegraph.pri +++ b/src/scenegraph/scenegraph.pri @@ -39,6 +39,7 @@ SOURCES += $$PWD/convenience/areaallocator.cpp \ $$PWD/convenience/utilities.cpp \ $$PWD/convenience/vertexcolormaterial.cpp \ + # 3D API (duplicates with qt3d) HEADERS += $$PWD/3d/qglnamespace.h \ $$PWD/3d/qt3dglobal.h \ @@ -52,7 +53,7 @@ HEADERS += $$PWD/3d/qglnamespace.h \ $$PWD/3d/qarray.h \ $$PWD/3d/qcustomdataarray.h \ $$PWD/3d/qcolor4ub.h \ - $$PWD/3d/qglext.h \ + SOURCES += $$PWD/3d/qgltexture2d.cpp \ $$PWD/3d/qarray.cpp \ @@ -63,7 +64,7 @@ SOURCES += $$PWD/3d/qgltexture2d.cpp \ $$PWD/3d/qglnamespace.cpp \ $$PWD/3d/qcustomdataarray.cpp \ $$PWD/3d/qcolor4ub.cpp \ - $$PWD/3d/qglext.cpp \ + isEmpty(HARFBUZZ_HEADERS): { QT_SOURCE_TREE = $$fromfile($$(QTDIR)/.qmake.cache,QT_SOURCE_TREE) |