Long live QOpenGLTexture!
Task-number: QTBUG-33274 Change-Id: I9259d947d11f8ba330a2cd7f5620d8f1af0a804b Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
parent
42d681f9cf
commit
1b34df6ea6
@ -56,6 +56,10 @@
|
||||
#include <private/qopenglextensions_p.h>
|
||||
#include <private/qopenglversionfunctionsfactory_p.h>
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
#include <private/qopengltexturehelper_p.h>
|
||||
#endif
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -523,6 +527,10 @@ void QOpenGLContext::destroy()
|
||||
d->versionFunctions.clear();
|
||||
qDeleteAll(d->versionFunctionsBackend);
|
||||
d->versionFunctionsBackend.clear();
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
delete d->textureFunctions;
|
||||
d->textureFunctions = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -976,6 +984,26 @@ void QOpenGLContext::removeFunctionsBackend(const QOpenGLVersionStatus &v)
|
||||
d->versionFunctionsBackend.remove(v);
|
||||
}
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
QOpenGLTextureHelper* QOpenGLContext::textureFunctions() const
|
||||
{
|
||||
Q_D(const QOpenGLContext);
|
||||
return d->textureFunctions;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void QOpenGLContext::setTextureFunctions(QOpenGLTextureHelper* textureFuncs)
|
||||
{
|
||||
Q_D(QOpenGLContext);
|
||||
d->textureFunctions = textureFuncs;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\class QOpenGLContextGroup
|
||||
\since 5.0
|
||||
|
@ -139,6 +139,9 @@ private:
|
||||
friend class QOpenGLMultiGroupSharedResource;
|
||||
};
|
||||
|
||||
|
||||
class QOpenGLTextureHelper;
|
||||
|
||||
class Q_GUI_EXPORT QOpenGLContext : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -207,6 +210,7 @@ private:
|
||||
friend class QSGDistanceFieldGlyphCache;
|
||||
friend class QWidgetPrivate;
|
||||
friend class QAbstractOpenGLFunctionsPrivate;
|
||||
friend class QOpenGLTexturePrivate;
|
||||
|
||||
void *qGLContextHandle() const;
|
||||
void setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *));
|
||||
@ -217,6 +221,11 @@ private:
|
||||
QOpenGLVersionFunctionsBackend *backend);
|
||||
void removeFunctionsBackend(const QOpenGLVersionStatus &v);
|
||||
|
||||
#if !defined(QT_OPENGL_ES_2)
|
||||
QOpenGLTextureHelper* textureFunctions() const;
|
||||
void setTextureFunctions(QOpenGLTextureHelper* textureFuncs);
|
||||
#endif
|
||||
|
||||
void destroy();
|
||||
};
|
||||
|
||||
|
@ -186,6 +186,7 @@ private:
|
||||
|
||||
class QPaintEngineEx;
|
||||
class QOpenGLFunctions;
|
||||
class QOpenGLTextureHelper;
|
||||
|
||||
class Q_GUI_EXPORT QOpenGLContextPrivate : public QObjectPrivate
|
||||
{
|
||||
@ -199,6 +200,7 @@ public:
|
||||
, screen(0)
|
||||
, surface(0)
|
||||
, functions(0)
|
||||
, textureFunctions(0)
|
||||
, current_fbo(0)
|
||||
, max_texture_size(-1)
|
||||
, workaround_brokenFBOReadBack(false)
|
||||
@ -228,6 +230,7 @@ public:
|
||||
QSurface *surface;
|
||||
QOpenGLFunctions *functions;
|
||||
mutable QSet<QByteArray> extensionNames;
|
||||
QOpenGLTextureHelper* textureFunctions;
|
||||
|
||||
GLuint current_fbo;
|
||||
GLint max_texture_size;
|
||||
|
@ -77,7 +77,11 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
|
||||
opengl/qopenglfunctions_4_2_compatibility.h \
|
||||
opengl/qopenglfunctions_4_3_compatibility.h \
|
||||
opengl/qopenglqueryhelper_p.h \
|
||||
opengl/qopengltimerquery.h
|
||||
opengl/qopengltimerquery.h \
|
||||
opengl/qopengltexture.h \
|
||||
opengl/qopengltexture_p.h \
|
||||
opengl/qopengltexturehelper_p.h \
|
||||
opengl/qopenglpixeltransferoptions.h
|
||||
|
||||
SOURCES += opengl/qopenglfunctions_1_0.cpp \
|
||||
opengl/qopenglfunctions_1_1.cpp \
|
||||
@ -101,7 +105,10 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
|
||||
opengl/qopenglfunctions_4_1_compatibility.cpp \
|
||||
opengl/qopenglfunctions_4_2_compatibility.cpp \
|
||||
opengl/qopenglfunctions_4_3_compatibility.cpp \
|
||||
opengl/qopengltimerquery.cpp
|
||||
opengl/qopengltimerquery.cpp \
|
||||
opengl/qopengltexture.cpp \
|
||||
opengl/qopengltexturehelper.cpp \
|
||||
opengl/qopenglpixeltransferoptions.cpp
|
||||
}
|
||||
|
||||
contains(QT_CONFIG, opengles2) {
|
||||
|
172
src/gui/opengl/qopenglpixeltransferoptions.cpp
Normal file
172
src/gui/opengl/qopenglpixeltransferoptions.cpp
Normal file
@ -0,0 +1,172 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** 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, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qopenglpixeltransferoptions.h"
|
||||
#include <QSharedData>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QOpenGLPixelTransferOptionsData : public QSharedData
|
||||
{
|
||||
public:
|
||||
QOpenGLPixelTransferOptionsData()
|
||||
: alignment(4)
|
||||
, skipImages(0)
|
||||
, skipRows(0)
|
||||
, skipPixels(0)
|
||||
, imageHeight(0)
|
||||
, rowLength(0)
|
||||
, lsbFirst(false)
|
||||
, swapBytes(false)
|
||||
{}
|
||||
|
||||
int alignment;
|
||||
int skipImages;
|
||||
int skipRows;
|
||||
int skipPixels;
|
||||
int imageHeight;
|
||||
int rowLength;
|
||||
bool lsbFirst;
|
||||
bool swapBytes;
|
||||
};
|
||||
|
||||
QOpenGLPixelTransferOptions::QOpenGLPixelTransferOptions()
|
||||
: data(new QOpenGLPixelTransferOptionsData)
|
||||
{
|
||||
}
|
||||
|
||||
QOpenGLPixelTransferOptions::QOpenGLPixelTransferOptions(const QOpenGLPixelTransferOptions &rhs)
|
||||
: data(rhs.data)
|
||||
{
|
||||
}
|
||||
|
||||
QOpenGLPixelTransferOptions &QOpenGLPixelTransferOptions::operator=(const QOpenGLPixelTransferOptions &rhs)
|
||||
{
|
||||
if (this != &rhs)
|
||||
data.operator=(rhs.data);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QOpenGLPixelTransferOptions::~QOpenGLPixelTransferOptions()
|
||||
{
|
||||
}
|
||||
|
||||
void QOpenGLPixelTransferOptions::setAlignment(int alignment)
|
||||
{
|
||||
data->alignment = alignment;
|
||||
}
|
||||
|
||||
int QOpenGLPixelTransferOptions::alignment() const
|
||||
{
|
||||
return data->alignment;
|
||||
}
|
||||
|
||||
void QOpenGLPixelTransferOptions::setSkipImages(int skipImages)
|
||||
{
|
||||
data->skipImages = skipImages;
|
||||
}
|
||||
|
||||
int QOpenGLPixelTransferOptions::skipImages() const
|
||||
{
|
||||
return data->skipImages;
|
||||
}
|
||||
|
||||
void QOpenGLPixelTransferOptions::setSkipRows(int skipRows)
|
||||
{
|
||||
data->skipRows = skipRows;
|
||||
}
|
||||
|
||||
int QOpenGLPixelTransferOptions::skipRows() const
|
||||
{
|
||||
return data->skipRows;
|
||||
}
|
||||
|
||||
void QOpenGLPixelTransferOptions::setSkipPixels(int skipPixels)
|
||||
{
|
||||
data->skipPixels = skipPixels;
|
||||
}
|
||||
|
||||
int QOpenGLPixelTransferOptions::skipPixels() const
|
||||
{
|
||||
return data->skipPixels;
|
||||
}
|
||||
|
||||
void QOpenGLPixelTransferOptions::setImageHeight(int imageHeight)
|
||||
{
|
||||
data->imageHeight = imageHeight;
|
||||
}
|
||||
|
||||
int QOpenGLPixelTransferOptions::imageHeight() const
|
||||
{
|
||||
return data->imageHeight;
|
||||
}
|
||||
|
||||
void QOpenGLPixelTransferOptions::setRowLength(int rowLength)
|
||||
{
|
||||
data->rowLength = rowLength;
|
||||
}
|
||||
|
||||
int QOpenGLPixelTransferOptions::rowLength() const
|
||||
{
|
||||
return data->rowLength;
|
||||
}
|
||||
|
||||
void QOpenGLPixelTransferOptions::setLeastSignificantByteFirst(bool lsbFirst)
|
||||
{
|
||||
data->lsbFirst = lsbFirst;
|
||||
}
|
||||
|
||||
bool QOpenGLPixelTransferOptions::isLeastSignificantBitFirst() const
|
||||
{
|
||||
return data->lsbFirst;
|
||||
}
|
||||
|
||||
void QOpenGLPixelTransferOptions::setSwapBytesEnabled(bool swapBytes)
|
||||
{
|
||||
data->swapBytes = swapBytes;
|
||||
}
|
||||
|
||||
bool QOpenGLPixelTransferOptions::isSwapBytesEnabled() const
|
||||
{
|
||||
return data->swapBytes;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
95
src/gui/opengl/qopenglpixeltransferoptions.h
Normal file
95
src/gui/opengl/qopenglpixeltransferoptions.h
Normal file
@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** 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, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QOPENGLPIXELUPLOADOPTIONS_H
|
||||
#define QOPENGLPIXELUPLOADOPTIONS_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if !defined(QT_NO_OPENGL)
|
||||
|
||||
#include <QSharedDataPointer>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QOpenGLPixelTransferOptionsData;
|
||||
|
||||
class Q_GUI_EXPORT QOpenGLPixelTransferOptions
|
||||
{
|
||||
public:
|
||||
QOpenGLPixelTransferOptions();
|
||||
QOpenGLPixelTransferOptions(const QOpenGLPixelTransferOptions &);
|
||||
QOpenGLPixelTransferOptions &operator=(const QOpenGLPixelTransferOptions &);
|
||||
~QOpenGLPixelTransferOptions();
|
||||
|
||||
void setAlignment(int alignment);
|
||||
int alignment() const;
|
||||
|
||||
void setSkipImages(int skipImages);
|
||||
int skipImages() const;
|
||||
|
||||
void setSkipRows(int skipRows);
|
||||
int skipRows() const;
|
||||
|
||||
void setSkipPixels(int skipPixels);
|
||||
int skipPixels() const;
|
||||
|
||||
void setImageHeight(int imageHeight);
|
||||
int imageHeight() const;
|
||||
|
||||
void setRowLength(int rowLength);
|
||||
int rowLength() const;
|
||||
|
||||
void setLeastSignificantByteFirst(bool lsbFirst);
|
||||
bool isLeastSignificantBitFirst() const;
|
||||
|
||||
void setSwapBytesEnabled(bool swapBytes);
|
||||
bool isSwapBytesEnabled() const;
|
||||
|
||||
private:
|
||||
QSharedDataPointer<QOpenGLPixelTransferOptionsData> data;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_OPENGL
|
||||
|
||||
#endif // QOPENGLPIXELUPLOADOPTIONS_H
|
2972
src/gui/opengl/qopengltexture.cpp
Normal file
2972
src/gui/opengl/qopengltexture.cpp
Normal file
File diff suppressed because it is too large
Load Diff
488
src/gui/opengl/qopengltexture.h
Normal file
488
src/gui/opengl/qopengltexture.h
Normal file
@ -0,0 +1,488 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** 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, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QOPENGLABSTRACTTEXTURE_H
|
||||
#define QOPENGLABSTRACTTEXTURE_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
||||
#include <QtGui/qopengl.h>
|
||||
#include <QtGui/qimage.h>
|
||||
#include <QtCore/QScopedPointer>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QOpenGLTexturePrivate;
|
||||
class QOpenGLPixelTransferOptions;
|
||||
|
||||
class Q_GUI_EXPORT QOpenGLTexture
|
||||
{
|
||||
public:
|
||||
enum Target {
|
||||
Target1D = 0x0DE0, // GL_TEXTURE_1D
|
||||
Target1DArray = 0x8C18, // GL_TEXTURE_1D_ARRAY
|
||||
Target2D = 0x0DE1, // GL_TEXTURE_2D
|
||||
Target2DArray = 0x8C1A, // GL_TEXTURE_2D_ARRAY
|
||||
Target3D = 0x806F, // GL_TEXTURE_3D
|
||||
TargetCubeMap = 0x8513, // GL_TEXTURE_CUBE_MAP
|
||||
TargetCubeMapArray = 0x9009, // GL_TEXTURE_CUBE_MAP_ARRAY
|
||||
Target2DMultisample = 0x9100, // GL_TEXTURE_2D_MULTISAMPLE
|
||||
Target2DMultisampleArray = 0x9102, // GL_TEXTURE_2D_MULTISAMPLE_ARRAY
|
||||
TargetRectangle = 0x84F5, // GL_TEXTURE_RECTANGLE
|
||||
TargetBuffer = 0x8C2A // GL_TEXTURE_BUFFER
|
||||
};
|
||||
|
||||
enum BindingTarget {
|
||||
BindingTarget1D = 0x8068, // GL_TEXTURE_BINDING_1D
|
||||
BindingTarget1DArray = 0x8C1C, // GL_TEXTURE_BINDING_1D_ARRAY
|
||||
BindingTarget2D = 0x8069, // GL_TEXTURE_BINDING_2D
|
||||
BindingTarget2DArray = 0x8C1D, // GL_TEXTURE_BINDING_2D_ARRAY
|
||||
BindingTarget3D = 0x806A, // GL_TEXTURE_BINDING_3D
|
||||
BindingTargetCubeMap = 0x8514, // GL_TEXTURE_BINDING_CUBE_MAP
|
||||
BindingTargetCubeMapArray = 0x900A, // GL_TEXTURE_BINDING_CUBE_MAP_ARRAY
|
||||
BindingTarget2DMultisample = 0x9104, // GL_TEXTURE_BINDING_2D_MULTISAMPLE
|
||||
BindingTarget2DMultisampleArray = 0x9105, // GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY
|
||||
BindingTargetRectangle = 0x84F6, // GL_TEXTURE_BINDING_RECTANGLE
|
||||
BindingTargetBuffer = 0x8C2C // GL_TEXTURE_BINDING_BUFFER
|
||||
};
|
||||
|
||||
enum MipMapGeneration {
|
||||
GenerateMipMaps,
|
||||
DontGenerateMipMaps
|
||||
};
|
||||
|
||||
enum TextureUnitReset {
|
||||
ResetTextureUnit,
|
||||
DontResetTextureUnit
|
||||
};
|
||||
|
||||
QOpenGLTexture(Target target);
|
||||
QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
|
||||
~QOpenGLTexture();
|
||||
|
||||
// Creation and destruction
|
||||
bool create();
|
||||
void destroy();
|
||||
bool isCreated() const;
|
||||
GLuint textureId() const;
|
||||
|
||||
// Binding and releasing
|
||||
void bind();
|
||||
void bind(uint unit, TextureUnitReset reset = DontResetTextureUnit);
|
||||
void release();
|
||||
void release(uint unit, TextureUnitReset reset = DontResetTextureUnit);
|
||||
|
||||
bool isBound() const;
|
||||
bool isBound(uint unit);
|
||||
static GLuint boundTextureId(BindingTarget target);
|
||||
static GLuint boundTextureId(uint unit, BindingTarget target);
|
||||
|
||||
enum TextureFormat {
|
||||
NoFormat = 0, // GL_NONE
|
||||
|
||||
// Unsigned normalized formats
|
||||
R8_UNorm = 0x8229, // GL_R8
|
||||
RG8_UNorm = 0x822B, // GL_RG8
|
||||
RGB8_UNorm = 0x8051, // GL_RGB8
|
||||
RGBA8_UNorm = 0x8058, // GL_RGBA8
|
||||
|
||||
R16_UNorm = 0x822A, // GL_R16
|
||||
RG16_UNorm = 0x822C, // GL_RG16
|
||||
RGB16_UNorm = 0x8054, // GL_RGB16
|
||||
RGBA16_UNorm = 0x805B, // GL_RGBA16
|
||||
|
||||
// Signed normalized formats
|
||||
R8_SNorm = 0x8F94, // GL_R8_SNORM
|
||||
RG8_SNorm = 0x8F95, // GL_RG8_SNORM
|
||||
RGB8_SNorm = 0x8F96, // GL_RGB8_SNORM
|
||||
RGBA8_SNorm = 0x8F97, // GL_RGBA8_SNORM
|
||||
|
||||
R16_SNorm = 0x8F98, // GL_R16_SNORM
|
||||
RG16_SNorm = 0x8F99, // GL_RG16_SNORM
|
||||
RGB16_SNorm = 0x8F9A, // GL_RGB16_SNORM
|
||||
RGBA16_SNorm = 0x8F9B, // GL_RGBA16_SNORM
|
||||
|
||||
// Unsigned integer formats
|
||||
R8U = 0x8232, // GL_R8UI
|
||||
RG8U = 0x8238, // GL_RG8UI
|
||||
RGB8U = 0x8D7D, // GL_RGB8UI
|
||||
RGBA8U = 0x8D7C, // GL_RGBA8UI
|
||||
|
||||
R16U = 0x8234, // GL_R16UI
|
||||
RG16U = 0x823A, // GL_RG16UI
|
||||
RGB16U = 0x8D77, // GL_RGB16UI
|
||||
RGBA16U = 0x8D76, // GL_RGBA16UI
|
||||
|
||||
R32U = 0x8236, // GL_R32UI
|
||||
RG32U = 0x823C, // GL_RG32UI
|
||||
RGB32U = 0x8D71, // GL_RGB32UI
|
||||
RGBA32U = 0x8D70, // GL_RGBA32UI
|
||||
|
||||
// Signed integer formats
|
||||
R8I = 0x8231, // GL_R8I
|
||||
RG8I = 0x8237, // GL_RG8I
|
||||
RGB8I = 0x8D8F, // GL_RGB8I
|
||||
RGBA8I = 0x8D8E, // GL_RGBA8I
|
||||
|
||||
R16I = 0x8233, // GL_R16I
|
||||
RG16I = 0x8239, // GL_RG16I
|
||||
RGB16I = 0x8D89, // GL_RGB16I
|
||||
RGBA16I = 0x8D88, // GL_RGBA16I
|
||||
|
||||
R32I = 0x8235, // GL_R32I
|
||||
RG32I = 0x823B, // GL_RG32I
|
||||
RGB32I = 0x8D83, // GL_RGB32I
|
||||
RGBA32I = 0x8D82, // GL_RGBA32I
|
||||
|
||||
// Floating point formats
|
||||
R16F = 0x822D, // GL_R16F
|
||||
RG16F = 0x822F, // GL_RG16F
|
||||
RGB16F = 0x881B, // GL_RGB16F
|
||||
RGBA16F = 0x881A, // GL_RGBA16F
|
||||
|
||||
R32F = 0x822E, // GL_R32F
|
||||
RG32F = 0x8230, // GL_RG32F
|
||||
RGB32F = 0x8815, // GL_RGB32F
|
||||
RGBA32F = 0x8814, // GL_RGBA32F
|
||||
|
||||
// Packed formats
|
||||
RGB9E5 = 0x8C3D, // GL_RGB9_E5
|
||||
RG11B10F = 0x8C3A, // GL_R11F_G11F_B10F
|
||||
RG3B2 = 0x2A10, // GL_R3_G3_B2
|
||||
R5G6B5 = 0x8D62, // GL_RGB565
|
||||
RGB5A1 = 0x8057, // GL_RGB5_A1
|
||||
RGBA4 = 0x8056, // GL_RGBA4
|
||||
RGB10A2 = 0x906F, // GL_RGB10_A2UI
|
||||
|
||||
// Depth formats
|
||||
D16 = 0x81A5, // GL_DEPTH_COMPONENT16
|
||||
D24 = 0x81A6, // GL_DEPTH_COMPONENT24
|
||||
D24S8 = 0x88F0, // GL_DEPTH24_STENCIL8
|
||||
D32 = 0x81A7, // GL_DEPTH_COMPONENT32
|
||||
D32F = 0x8CAC, // GL_DEPTH_COMPONENT32F
|
||||
D32FS8X24 = 0x8CAD, // GL_DEPTH32F_STENCIL8
|
||||
|
||||
// Compressed formats
|
||||
RGB_DXT1 = 0x83F0, // GL_COMPRESSED_RGB_S3TC_DXT1_EXT
|
||||
RGBA_DXT1 = 0x83F1, // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
|
||||
RGBA_DXT3 = 0x83F2, // GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
|
||||
RGBA_DXT5 = 0x83F3, // GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
|
||||
R_ATI1N_UNorm = 0x8DBB, // GL_COMPRESSED_RED_RGTC1
|
||||
R_ATI1N_SNorm = 0x8DBC, // GL_COMPRESSED_SIGNED_RED_RGTC1
|
||||
RG_ATI2N_UNorm = 0x8DBD, // GL_COMPRESSED_RG_RGTC2
|
||||
RG_ATI2N_SNorm = 0x8DBE, // GL_COMPRESSED_SIGNED_RG_RGTC2
|
||||
RGB_BP_UNSIGNED_FLOAT = 0x8E8F, // GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
|
||||
RGB_BP_SIGNED_FLOAT = 0x8E8E, // GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
|
||||
RGB_BP_UNorm = 0x8E8C, // GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
|
||||
|
||||
// sRGB formats
|
||||
SRGB8 = 0x8C41, // GL_SRGB8
|
||||
SRGB8_Alpha8 = 0x8C43, // GL_SRGB8_ALPHA8
|
||||
SRGB_DXT1 = 0x8C4C, // GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
|
||||
SRGB_Alpha_DXT1 = 0x8C4D, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
|
||||
SRGB_Alpha_DXT3 = 0x8C4E, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
|
||||
SRGB_Alpha_DXT5 = 0x8C4F, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
|
||||
SRGB_BP_UNorm = 0x8E8D // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
|
||||
};
|
||||
|
||||
// This is not used externally yet but is reserved to allow checking of
|
||||
// compatibility between texture formats
|
||||
#ifndef Q_QDOC
|
||||
enum TextureFormatClass {
|
||||
NoFormatClass,
|
||||
FormatClass_128Bit,
|
||||
FormatClass_96Bit,
|
||||
FormatClass_64Bit,
|
||||
FormatClass_48Bit,
|
||||
FormatClass_32Bit,
|
||||
FormatClass_24Bit,
|
||||
FormatClass_16Bit,
|
||||
FormatClass_8Bit,
|
||||
FormatClass_RGTC1_R,
|
||||
FormatClass_RGTC2_RG,
|
||||
FormatClass_BPTC_Unorm,
|
||||
FormatClass_BPTC_Float,
|
||||
FormatClass_S3TC_DXT1_RGB,
|
||||
FormatClass_S3TC_DXT1_RGBA,
|
||||
FormatClass_S3TC_DXT3_RGBA,
|
||||
FormatClass_S3TC_DXT5_RGBA,
|
||||
FormatClass_Unique
|
||||
};
|
||||
#endif
|
||||
|
||||
// Storage allocation
|
||||
void setFormat(TextureFormat format);
|
||||
TextureFormat format() const;
|
||||
void setSize(int width, int height = 1, int depth = 1);
|
||||
int width() const;
|
||||
int height() const;
|
||||
int depth() const;
|
||||
void setMipLevels(int levels);
|
||||
int mipLevels() const;
|
||||
int maximumMipLevels() const;
|
||||
void setLayers(int layers);
|
||||
int layers() const;
|
||||
int faces() const;
|
||||
void allocateStorage();
|
||||
bool isStorageAllocated() const;
|
||||
|
||||
QOpenGLTexture *createTextureView(Target target,
|
||||
TextureFormat viewFormat,
|
||||
int minimumMipmapLevel, int maximumMipmapLevel,
|
||||
int minimumLayer, int maximumLayer) const;
|
||||
bool isTextureView() const;
|
||||
|
||||
enum CubeMapFace {
|
||||
CubeMapPositiveX = 0x8515, // GL_TEXTURE_CUBE_MAP_POSITIVE_X
|
||||
CubeMapNegativeX = 0x8516, // GL_TEXTURE_CUBE_MAP_NEGATIVE_X
|
||||
CubeMapPositiveY = 0x8517, // GL_TEXTURE_CUBE_MAP_POSITIVE_Y
|
||||
CubeMapNegativeY = 0x8518, // GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
|
||||
CubeMapPositiveZ = 0x8519, // GL_TEXTURE_CUBE_MAP_POSITIVE_Z
|
||||
CubeMapNegativeZ = 0x851A // GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
|
||||
};
|
||||
|
||||
enum PixelFormat {
|
||||
NoSourceFormat = 0, // GL_NONE
|
||||
Red = 0x1903, // GL_RED
|
||||
RG = 0x8227, // GL_RG
|
||||
RGB = 0x1907, // GL_RGB
|
||||
BGR = 0x80E0, // GL_BGR
|
||||
RGBA = 0x1908, // GL_RGBA
|
||||
BGRA = 0x80E1, // GL_BGRA
|
||||
Red_Integer = 0x8D94, // GL_RED_INTEGER
|
||||
RG_Integer = 0x8228, // GL_RG_INTEGER
|
||||
RGB_Integer = 0x8D98, // GL_RGB_INTEGER
|
||||
BGR_Integer = 0x8D9A, // GL_BGR_INTEGER
|
||||
RGBA_Integer = 0x8D99, // GL_RGBA_INTEGER
|
||||
BGRA_Integer = 0x8D9B, // GL_BGRA_INTEGER
|
||||
Depth = 0x1902, // GL_DEPTH_COMPONENT
|
||||
DepthStencil = 0x84F9 // GL_DEPTH_STENCIL
|
||||
};
|
||||
|
||||
enum PixelType {
|
||||
NoPixelType = 0, // GL_NONE
|
||||
Int8 = 0x1400, // GL_BYTE
|
||||
UInt8 = 0x1401, // GL_UNSIGNED_BYTE
|
||||
Int16 = 0x1402, // GL_SHORT
|
||||
UInt16 = 0x1403, // GL_UNSIGNED_SHORT
|
||||
Int32 = 0x1404, // GL_INT
|
||||
UInt32 = 0x1405, // GL_UNSIGNED_INT
|
||||
Float16 = 0x140B, // GL_HALF_FLOAT
|
||||
Float32 = 0x1406, // GL_FLOAT
|
||||
UInt32_RGB9_E5 = 0x8C3E, // GL_UNSIGNED_INT_5_9_9_9_REV
|
||||
UInt32_RG11B10F = 0x8C3B, // GL_UNSIGNED_INT_10F_11F_11F_REV
|
||||
UInt8_RG3B2 = 0x8032, // GL_UNSIGNED_BYTE_3_3_2
|
||||
UInt8_RG3B2_Rev = 0x8362, // GL_UNSIGNED_BYTE_2_3_3_REV
|
||||
UInt16_RGB5A1 = 0x8034, // GL_UNSIGNED_SHORT_5_5_5_1
|
||||
UInt16_RGB5A1_Rev = 0x8366, // GL_UNSIGNED_SHORT_1_5_5_5_REV
|
||||
UInt16_R5G6B5 = 0x8363, // GL_UNSIGNED_SHORT_5_6_5
|
||||
UInt16_R5G6B5_Rev = 0x8364, // GL_UNSIGNED_SHORT_5_6_5_REV
|
||||
UInt16_RGBA4 = 0x8033, // GL_UNSIGNED_SHORT_4_4_4_4
|
||||
UInt16_RGBA4_Rev = 0x8365, // GL_UNSIGNED_SHORT_4_4_4_4_REV
|
||||
UInt32_RGB10A2 = 0x8036, // GL_UNSIGNED_INT_10_10_10_2
|
||||
UInt32_RGB10A2_Rev = 0x8368 // GL_UNSIGNED_INT_2_10_10_10_REV
|
||||
};
|
||||
|
||||
// Pixel transfer
|
||||
void setData(int mipLevel, int layer, CubeMapFace cubeFace,
|
||||
PixelFormat sourceFormat, PixelType sourceType,
|
||||
void *data, const QOpenGLPixelTransferOptions * const options = 0);
|
||||
void setData(int mipLevel, int layer,
|
||||
PixelFormat sourceFormat, PixelType sourceType,
|
||||
void *data, const QOpenGLPixelTransferOptions * const options = 0);
|
||||
void setData(int mipLevel,
|
||||
PixelFormat sourceFormat, PixelType sourceType,
|
||||
void *data, const QOpenGLPixelTransferOptions * const options = 0);
|
||||
void setData(PixelFormat sourceFormat, PixelType sourceType,
|
||||
void *data, const QOpenGLPixelTransferOptions * const options = 0);
|
||||
|
||||
// Compressed data upload
|
||||
void setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace,
|
||||
int dataSize, void *data,
|
||||
const QOpenGLPixelTransferOptions * const options = 0);
|
||||
void setCompressedData(int mipLevel, int layer,
|
||||
int dataSize, void *data,
|
||||
const QOpenGLPixelTransferOptions * const options = 0);
|
||||
void setCompressedData(int mipLevel, int dataSize, void *data,
|
||||
const QOpenGLPixelTransferOptions * const options = 0);
|
||||
void setCompressedData(int dataSize, void *data,
|
||||
const QOpenGLPixelTransferOptions * const options = 0);
|
||||
|
||||
// Helpful overloads for setData
|
||||
void setData(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
|
||||
|
||||
// Features
|
||||
enum Feature {
|
||||
ImmutableStorage = 0x00000001,
|
||||
ImmutableMultisampleStorage = 0x00000002,
|
||||
TextureRectangle = 0x00000004,
|
||||
TextureArrays = 0x00000008,
|
||||
Texture3D = 0x00000010,
|
||||
TextureMultisample = 0x00000020,
|
||||
TextureBuffer = 0x00000040,
|
||||
TextureCubeMapArrays = 0x00000080,
|
||||
Swizzle = 0x00000100,
|
||||
StencilTexturing = 0x00000200,
|
||||
AnisotropicFiltering = 0x00000400,
|
||||
NPOTTextures = 0x00000800,
|
||||
NPOTTextureRepeat = 0x00001000,
|
||||
#ifndef Q_QDOC
|
||||
MaxFeatureFlag = 0x00002000
|
||||
#endif
|
||||
};
|
||||
Q_DECLARE_FLAGS(Features, Feature)
|
||||
|
||||
static bool hasFeature(Feature feature);
|
||||
|
||||
// Texture Parameters
|
||||
void setMipBaseLevel(int baseLevel);
|
||||
int mipBaseLevel() const;
|
||||
void setMipMaxLevel(int maxLevel);
|
||||
int mipMaxLevel() const;
|
||||
void setMipLevelRange(int baseLevel, int maxLevel);
|
||||
QPair<int, int> mipLevelRange() const;
|
||||
|
||||
void setAutoMipMapGenerationEnabled(bool enabled);
|
||||
bool isAutoMipMapGenerationEnabled() const;
|
||||
|
||||
void generateMipMaps();
|
||||
void generateMipMaps(int baseLevel, bool resetBaseLevel = true);
|
||||
|
||||
enum SwizzleComponent {
|
||||
SwizzleRed = 0x8E42, // GL_TEXTURE_SWIZZLE_R
|
||||
SwizzleGreen = 0x8E43, // GL_TEXTURE_SWIZZLE_G
|
||||
SwizzleBlue = 0x8E44, // GL_TEXTURE_SWIZZLE_B
|
||||
SwizzleAlpha = 0x8E45 // GL_TEXTURE_SWIZZLE_A
|
||||
};
|
||||
|
||||
enum SwizzleValue {
|
||||
RedValue = 0x1903, // GL_RED
|
||||
GreenValue = 0x1904, // GL_GREEN
|
||||
BlueValue = 0x1905, // GL_BLUE
|
||||
AlphaValue = 0x1906, // GL_ALPHA
|
||||
ZeroValue = 0, // GL_ZERO
|
||||
OneValue = 1 // GL_ONE
|
||||
};
|
||||
|
||||
void setSwizzleMask(SwizzleComponent component, SwizzleValue value);
|
||||
void setSwizzleMask(SwizzleValue r, SwizzleValue g,
|
||||
SwizzleValue b, SwizzleValue a);
|
||||
SwizzleValue swizzleMask(SwizzleComponent component) const;
|
||||
|
||||
enum DepthStencilMode {
|
||||
DepthMode = 0x1902, // GL_DEPTH_COMPONENT
|
||||
StencilMode = 0x1901 // GL_STENCIL_INDEX
|
||||
};
|
||||
|
||||
void setDepthStencilMode(DepthStencilMode mode);
|
||||
DepthStencilMode depthStencilMode() const;
|
||||
|
||||
// Sampling Parameters
|
||||
enum Filter {
|
||||
Nearest = 0x2600, // GL_NEAREST
|
||||
Linear = 0x2601, // GL_LINEAR
|
||||
NearestMipMapNearest = 0x2700, // GL_NEAREST_MIPMAP_NEAREST
|
||||
NearestMipMapLinear = 0x2702, // GL_NEAREST_MIPMAP_LINEAR
|
||||
LinearMipMapNearest = 0x2701, // GL_LINEAR_MIPMAP_NEAREST
|
||||
LinearMipMapLinear = 0x2703 // GL_LINEAR_MIPMAP_LINEAR
|
||||
};
|
||||
|
||||
void setMinificationFilter(Filter filter);
|
||||
Filter minificationFilter() const;
|
||||
void setMagnificationFilter(Filter filter);
|
||||
Filter magnificationFilter() const;
|
||||
void setMinMagFilters(Filter minificationFilter,
|
||||
Filter magnificationFilter);
|
||||
QPair<Filter, Filter> minMagFilters() const;
|
||||
void setMaximumAnisotropy(float anisotropy);
|
||||
float maximumAnisotropy() const;
|
||||
|
||||
enum WrapMode {
|
||||
Repeat = 0x2901, // GL_REPEAT
|
||||
MirroredRepeat = 0x8370, // GL_MIRRORED_REPEAT
|
||||
ClampToEdge = 0x812F, // GL_CLAMP_TO_EDGE
|
||||
ClampToBorder = 0x812D // GL_CLAMP_TO_BORDER
|
||||
};
|
||||
|
||||
enum CoordinateDirection {
|
||||
DirectionS = 0x2802, // GL_TEXTURE_WRAP_S
|
||||
DirectionT = 0x2803, // GL_TEXTURE_WRAP_T
|
||||
DirectionR = 0x8072 // GL_TEXTURE_WRAP_R
|
||||
};
|
||||
|
||||
void setWrapMode(WrapMode mode);
|
||||
void setWrapMode(CoordinateDirection direction, WrapMode mode);
|
||||
WrapMode wrapMode(CoordinateDirection direction) const;
|
||||
|
||||
void setBorderColor(QColor color);
|
||||
void setBorderColor(float r, float g, float b, float a);
|
||||
void setBorderColor(int r, int g, int b, int a);
|
||||
void setBorderColor(uint r, uint g, uint b, uint a);
|
||||
|
||||
QColor borderColor() const;
|
||||
void borderColor(float *border) const;
|
||||
void borderColor(int *border) const;
|
||||
void borderColor(unsigned int *border) const;
|
||||
|
||||
void setMinimumLevelOfDetail(float value);
|
||||
float minimumLevelOfDetail() const;
|
||||
void setMaximumLevelOfDetail(float value);
|
||||
float maximumLevelOfDetail() const;
|
||||
void setLevelOfDetailRange(float min, float max);
|
||||
QPair<float, float> levelOfDetailRange() const;
|
||||
void setLevelofDetailBias(float bias);
|
||||
float levelofDetailBias() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QOpenGLTexture)
|
||||
Q_DECLARE_PRIVATE(QOpenGLTexture)
|
||||
QScopedPointer<QOpenGLTexturePrivate> d_ptr;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLTexture::Features)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_OPENGL
|
||||
|
||||
#endif // QOPENGLABSTRACTTEXTURE_H
|
164
src/gui/opengl/qopengltexture_p.h
Normal file
164
src/gui/opengl/qopengltexture_p.h
Normal file
@ -0,0 +1,164 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** 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, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QABSTRACTOPENGLTEXTURE_P_H
|
||||
#define QABSTRACTOPENGLTEXTURE_P_H
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
|
||||
#include "private/qobject_p.h"
|
||||
#include "qopengltexture.h"
|
||||
#include "qopengl.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace {
|
||||
inline double qLog2(const double x)
|
||||
{
|
||||
return std::log(x) / std::log(2.0);
|
||||
}
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QOpenGLContext;
|
||||
class QOpenGLTextureHelper;
|
||||
|
||||
class QOpenGLTexturePrivate
|
||||
{
|
||||
public:
|
||||
QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget,
|
||||
QOpenGLTexture *qq);
|
||||
~QOpenGLTexturePrivate();
|
||||
|
||||
Q_DECLARE_PUBLIC(QOpenGLTexture)
|
||||
|
||||
void resetFuncs(QOpenGLTextureHelper *funcs);
|
||||
void initializeOpenGLFunctions();
|
||||
|
||||
bool create();
|
||||
void destroy();
|
||||
|
||||
void bind();
|
||||
void bind(uint unit, QOpenGLTexture::TextureUnitReset reset = QOpenGLTexture::DontResetTextureUnit);
|
||||
void release();
|
||||
void release(uint unit, QOpenGLTexture::TextureUnitReset reset = QOpenGLTexture::DontResetTextureUnit);
|
||||
bool isBound() const;
|
||||
bool isBound(uint unit) const;
|
||||
|
||||
void allocateStorage();
|
||||
void allocateMutableStorage();
|
||||
void allocateImmutableStorage();
|
||||
void setData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace,
|
||||
QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType,
|
||||
void *data, const QOpenGLPixelTransferOptions * const options);
|
||||
void setCompressedData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace,
|
||||
int dataSize, void *data,
|
||||
const QOpenGLPixelTransferOptions * const options);
|
||||
|
||||
void setWrapMode(QOpenGLTexture::WrapMode mode);
|
||||
void setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode);
|
||||
QOpenGLTexture::WrapMode wrapMode(QOpenGLTexture::CoordinateDirection direction) const;
|
||||
|
||||
QOpenGLTexture *createTextureView(QOpenGLTexture::Target target, QOpenGLTexture::TextureFormat viewFormat,
|
||||
int minimumMipmapLevel, int maximumMipmapLevel,
|
||||
int minimumLayer, int maximumLayer) const;
|
||||
|
||||
int evaluateMipLevels() const;
|
||||
|
||||
inline int maximumMipLevelCount() const
|
||||
{
|
||||
return 1 + std::floor(qLog2(qMax(dimensions[0], qMax(dimensions[1], dimensions[2]))));
|
||||
}
|
||||
|
||||
static inline int mipLevelSize(int mipLevel, int baseLevelSize)
|
||||
{
|
||||
return std::floor(double(qMax(1, baseLevelSize >> mipLevel)));
|
||||
}
|
||||
|
||||
QOpenGLTexture *q_ptr;
|
||||
QOpenGLContext *context;
|
||||
QOpenGLTexture::Target target;
|
||||
QOpenGLTexture::BindingTarget bindingTarget;
|
||||
GLuint textureId;
|
||||
QOpenGLTexture::TextureFormat format;
|
||||
QOpenGLTexture::TextureFormatClass formatClass;
|
||||
int dimensions[3];
|
||||
int requestedMipLevels;
|
||||
int mipLevels;
|
||||
int layers;
|
||||
int faces;
|
||||
|
||||
int samples;
|
||||
bool fixedSamplePositions;
|
||||
|
||||
int baseLevel;
|
||||
int maxLevel;
|
||||
|
||||
QOpenGLTexture::SwizzleValue swizzleMask[4];
|
||||
QOpenGLTexture::DepthStencilMode depthStencilMode;
|
||||
|
||||
QOpenGLTexture::Filter minFilter;
|
||||
QOpenGLTexture::Filter magFilter;
|
||||
float maxAnisotropy;
|
||||
QOpenGLTexture::WrapMode wrapModes[3];
|
||||
QVariantList borderColor;
|
||||
float minLevelOfDetail;
|
||||
float maxLevelOfDetail;
|
||||
float levelOfDetailBias;
|
||||
|
||||
bool textureView;
|
||||
bool autoGenerateMipMaps;
|
||||
bool storageAllocated;
|
||||
|
||||
QPair<int, int> glVersion;
|
||||
QOpenGLTextureHelper *texFuncs;
|
||||
|
||||
QOpenGLTexture::Features features;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#undef Q_CALL_MEMBER_FUNCTION
|
||||
|
||||
#endif // QT_NO_OPENGL
|
||||
|
||||
#endif // QABSTRACTOPENGLTEXTURE_P_H
|
219
src/gui/opengl/qopengltexturehelper.cpp
Normal file
219
src/gui/opengl/qopengltexturehelper.cpp
Normal file
@ -0,0 +1,219 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** 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, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qopengltexturehelper_p.h"
|
||||
|
||||
#include <QOpenGLContext>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
|
||||
{
|
||||
// Resolve EXT_direct_state_access entry points if present
|
||||
if (context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) {
|
||||
TextureParameteriEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLint )>(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT")));
|
||||
TextureParameterivEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLint *)>(context->getProcAddress(QByteArrayLiteral("glTextureParameterivEXT")));
|
||||
TextureParameterfEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLfloat )>(context->getProcAddress(QByteArrayLiteral("glTextureParameterfEXT")));
|
||||
TextureParameterfvEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLfloat *)>(context->getProcAddress(QByteArrayLiteral("glTextureParameterfvEXT")));
|
||||
GenerateTextureMipmapEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum )>(context->getProcAddress(QByteArrayLiteral("glGenerateTextureMipmapEXT")));
|
||||
TextureStorage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage3DEXT")));
|
||||
TextureStorage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage2DEXT")));
|
||||
TextureStorage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage1DEXT")));
|
||||
TextureStorage3DMultisampleEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage3DMultisampleEXT")));
|
||||
TextureStorage2DMultisampleEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureStorage2DMultisampleEXT")));
|
||||
TextureImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureImage3DEXT")));
|
||||
TextureImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureImage2DEXT")));
|
||||
TextureImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureImage1DEXT")));
|
||||
TextureSubImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureSubImage3DEXT")));
|
||||
TextureSubImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureSubImage2DEXT")));
|
||||
TextureSubImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTextureSubImage1DEXT")));
|
||||
CompressedTextureSubImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureSubImage1DEXT")));
|
||||
CompressedTextureSubImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureSubImage2DEXT")));
|
||||
CompressedTextureSubImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureSubImage3DEXT")));
|
||||
CompressedTextureImage1DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureImage1DEXT")));
|
||||
CompressedTextureImage2DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureImage2DEXT")));
|
||||
CompressedTextureImage3DEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTextureImage3DEXT")));
|
||||
|
||||
// Use the real DSA functions
|
||||
TextureParameteri = &QOpenGLTextureHelper::dsa_TextureParameteri;
|
||||
TextureParameteriv = &QOpenGLTextureHelper::dsa_TextureParameteriv;
|
||||
TextureParameterf = &QOpenGLTextureHelper::dsa_TextureParameterf;
|
||||
TextureParameterfv = &QOpenGLTextureHelper::dsa_TextureParameterfv;
|
||||
GenerateTextureMipmap = &QOpenGLTextureHelper::dsa_GenerateTextureMipmap;
|
||||
TextureStorage3D = &QOpenGLTextureHelper::dsa_TextureStorage3D;
|
||||
TextureStorage2D = &QOpenGLTextureHelper::dsa_TextureStorage2D;
|
||||
TextureStorage1D = &QOpenGLTextureHelper::dsa_TextureStorage1D;
|
||||
TextureStorage3DMultisample = &QOpenGLTextureHelper::dsa_TextureStorage3DMultisample;
|
||||
TextureStorage2DMultisample = &QOpenGLTextureHelper::dsa_TextureStorage2DMultisample;
|
||||
TextureImage3D = &QOpenGLTextureHelper::dsa_TextureImage3D;
|
||||
TextureImage2D = &QOpenGLTextureHelper::dsa_TextureImage2D;
|
||||
TextureImage1D = &QOpenGLTextureHelper::dsa_TextureImage1D;
|
||||
TextureSubImage3D = &QOpenGLTextureHelper::dsa_TextureSubImage3D;
|
||||
TextureSubImage2D = &QOpenGLTextureHelper::dsa_TextureSubImage2D;
|
||||
TextureSubImage1D = &QOpenGLTextureHelper::dsa_TextureSubImage1D;
|
||||
CompressedTextureSubImage1D = &QOpenGLTextureHelper::dsa_CompressedTextureSubImage1D;
|
||||
CompressedTextureSubImage2D = &QOpenGLTextureHelper::dsa_CompressedTextureSubImage2D;
|
||||
CompressedTextureSubImage3D = &QOpenGLTextureHelper::dsa_CompressedTextureSubImage3D;
|
||||
CompressedTextureImage1D = &QOpenGLTextureHelper::dsa_CompressedTextureImage1D;
|
||||
CompressedTextureImage2D = &QOpenGLTextureHelper::dsa_CompressedTextureImage2D;
|
||||
CompressedTextureImage3D = &QOpenGLTextureHelper::dsa_CompressedTextureImage3D;
|
||||
} else {
|
||||
// Use our own DSA emulation
|
||||
TextureParameteri = &QOpenGLTextureHelper::qt_TextureParameteri;
|
||||
TextureParameteriv = &QOpenGLTextureHelper::qt_TextureParameteriv;
|
||||
GenerateTextureMipmap = &QOpenGLTextureHelper::qt_GenerateTextureMipmap;
|
||||
TextureStorage3D = &QOpenGLTextureHelper::qt_TextureStorage3D;
|
||||
TextureStorage2D = &QOpenGLTextureHelper::qt_TextureStorage2D;
|
||||
TextureStorage1D = &QOpenGLTextureHelper::qt_TextureStorage1D;
|
||||
TextureStorage3DMultisample = &QOpenGLTextureHelper::qt_TextureStorage3DMultisample;
|
||||
TextureStorage2DMultisample = &QOpenGLTextureHelper::qt_TextureStorage2DMultisample;
|
||||
TextureImage3D = &QOpenGLTextureHelper::qt_TextureImage3D;
|
||||
TextureImage2D = &QOpenGLTextureHelper::qt_TextureImage2D;
|
||||
TextureImage1D = &QOpenGLTextureHelper::qt_TextureImage1D;
|
||||
TextureSubImage3D = &QOpenGLTextureHelper::qt_TextureSubImage3D;
|
||||
TextureSubImage2D = &QOpenGLTextureHelper::qt_TextureSubImage2D;
|
||||
TextureSubImage1D = &QOpenGLTextureHelper::qt_TextureSubImage1D;
|
||||
CompressedTextureSubImage1D = &QOpenGLTextureHelper::qt_CompressedTextureSubImage1D;
|
||||
CompressedTextureSubImage2D = &QOpenGLTextureHelper::qt_CompressedTextureSubImage2D;
|
||||
CompressedTextureSubImage3D = &QOpenGLTextureHelper::qt_CompressedTextureSubImage3D;
|
||||
CompressedTextureImage1D = &QOpenGLTextureHelper::qt_CompressedTextureImage1D;
|
||||
CompressedTextureImage2D = &QOpenGLTextureHelper::qt_CompressedTextureImage2D;
|
||||
CompressedTextureImage3D = &QOpenGLTextureHelper::qt_CompressedTextureImage3D;
|
||||
}
|
||||
|
||||
// Some DSA functions are part of NV_texture_multisample instead
|
||||
if (context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) {
|
||||
TextureImage3DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage3DMultisampleNV")));
|
||||
TextureImage2DMultisampleNV = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTextureImage2DMultisampleNV")));
|
||||
|
||||
TextureImage3DMultisample = &QOpenGLTextureHelper::dsa_TextureImage3DMultisample;
|
||||
TextureImage2DMultisample = &QOpenGLTextureHelper::dsa_TextureImage2DMultisample;
|
||||
} else {
|
||||
TextureImage3DMultisample = &QOpenGLTextureHelper::qt_TextureImage3DMultisample;
|
||||
TextureImage2DMultisample = &QOpenGLTextureHelper::qt_TextureImage2DMultisample;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
HMODULE handle = GetModuleHandleA("opengl32.dll");
|
||||
|
||||
// OpenGL 1.0
|
||||
GetIntegerv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint *)>(GetProcAddress(handle, QByteArrayLiteral("glGetIntegerv")));
|
||||
GetBooleanv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLboolean *)>(GetProcAddress(handle, QByteArrayLiteral("glGetBooleanv")));
|
||||
PixelStorei = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint )>(GetProcAddress(handle, QByteArrayLiteral("glPixelStorei")));
|
||||
GetTexLevelParameteriv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLint *)>(GetProcAddress(handle, QByteArrayLiteral("glGetTexLevelParameteriv")));
|
||||
GetTexLevelParameterfv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLfloat *)>(GetProcAddress(handle, QByteArrayLiteral("glGetTexLevelParameterfv")));
|
||||
GetTexParameteriv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLint *)>(GetProcAddress(handle, QByteArrayLiteral("glGetTexParameteriv")));
|
||||
GetTexParameterfv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLfloat *)>(GetProcAddress(handle, QByteArrayLiteral("glGetTexParameterfv")));
|
||||
GetTexImage = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLenum , GLvoid *)>(GetProcAddress(handle, QByteArrayLiteral("glGetTexImage")));
|
||||
TexImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(GetProcAddress(handle, QByteArrayLiteral("glTexImage2D")));
|
||||
TexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(GetProcAddress(handle, QByteArrayLiteral("glTexImage1D")));
|
||||
TexParameteriv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , const GLint *)>(GetProcAddress(handle, QByteArrayLiteral("glTexParameteriv")));
|
||||
TexParameteri = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLint )>(GetProcAddress(handle, QByteArrayLiteral("glTexParameteri")));
|
||||
TexParameterfv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , const GLfloat *)>(GetProcAddress(handle, QByteArrayLiteral("glTexParameterfv")));
|
||||
TexParameterf = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLfloat )>(GetProcAddress(handle, QByteArrayLiteral("glTexParameterf")));
|
||||
|
||||
// OpenGL 1.1
|
||||
GenTextures = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(GetProcAddress(handle, QByteArrayLiteral("glGenTextures")));
|
||||
DeleteTextures = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(GetProcAddress(handle, QByteArrayLiteral("glDeleteTextures")));
|
||||
BindTexture = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLuint )>(GetProcAddress(handle, QByteArrayLiteral("glBindTexture")));
|
||||
TexSubImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(GetProcAddress(handle, QByteArrayLiteral("glTexSubImage2D")));
|
||||
TexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(GetProcAddress(handle, QByteArrayLiteral("glTexSubImage1D")));
|
||||
|
||||
#else
|
||||
|
||||
// OpenGL 1.0
|
||||
GetIntegerv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint *)>(context->getProcAddress(QByteArrayLiteral("glGetIntegerv")));
|
||||
GetBooleanv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLboolean *)>(context->getProcAddress(QByteArrayLiteral("glGetBooleanv")));
|
||||
PixelStorei = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint )>(context->getProcAddress(QByteArrayLiteral("glPixelStorei")));
|
||||
GetTexLevelParameteriv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLint *)>(context->getProcAddress(QByteArrayLiteral("glGetTexLevelParameteriv")));
|
||||
GetTexLevelParameterfv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLfloat *)>(context->getProcAddress(QByteArrayLiteral("glGetTexLevelParameterfv")));
|
||||
GetTexParameteriv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLint *)>(context->getProcAddress(QByteArrayLiteral("glGetTexParameteriv")));
|
||||
GetTexParameterfv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLfloat *)>(context->getProcAddress(QByteArrayLiteral("glGetTexParameterfv")));
|
||||
GetTexImage = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLenum , GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glGetTexImage")));
|
||||
TexImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexImage2D")));
|
||||
TexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexImage1D")));
|
||||
TexParameteriv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , const GLint *)>(context->getProcAddress(QByteArrayLiteral("glTexParameteriv")));
|
||||
TexParameteri = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLint )>(context->getProcAddress(QByteArrayLiteral("glTexParameteri")));
|
||||
TexParameterfv = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , const GLfloat *)>(context->getProcAddress(QByteArrayLiteral("glTexParameterfv")));
|
||||
TexParameterf = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLfloat )>(context->getProcAddress(QByteArrayLiteral("glTexParameterf")));
|
||||
|
||||
// OpenGL 1.1
|
||||
GenTextures = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , GLuint *)>(context->getProcAddress(QByteArrayLiteral("glGenTextures")));
|
||||
DeleteTextures = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLsizei , const GLuint *)>(context->getProcAddress(QByteArrayLiteral("glDeleteTextures")));
|
||||
BindTexture = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLuint )>(context->getProcAddress(QByteArrayLiteral("glBindTexture")));
|
||||
TexSubImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage2D")));
|
||||
TexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage1D")));
|
||||
#endif
|
||||
|
||||
// OpenGL 1.2
|
||||
TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexImage3D")));
|
||||
TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage3D")));
|
||||
|
||||
// OpenGL 1.3
|
||||
GetCompressedTexImage = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glGetCompressedTexImage")));
|
||||
CompressedTexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage1D")));
|
||||
CompressedTexSubImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage2D")));
|
||||
CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage3D")));
|
||||
CompressedTexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage1D")));
|
||||
CompressedTexImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage2D")));
|
||||
CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3D")));
|
||||
ActiveTexture = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum )>(context->getProcAddress(QByteArrayLiteral("glActiveTexture")));
|
||||
|
||||
// OpenGL 3.0
|
||||
GenerateMipmap = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum )>(context->getProcAddress(QByteArrayLiteral("glGenerateMipmap")));
|
||||
|
||||
// OpenGL 3.2
|
||||
TexImage3DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLint , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTexImage3DMultisample")));
|
||||
TexImage2DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLint , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTexImage2DMultisample")));
|
||||
|
||||
// OpenGL 4.2
|
||||
TexStorage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTexStorage3D")));
|
||||
TexStorage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTexStorage2D")));
|
||||
TexStorage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei )>(context->getProcAddress(QByteArrayLiteral("glTexStorage1D")));
|
||||
|
||||
// OpenGL 4.3
|
||||
TexStorage3DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTexStorage3DMultisample")));
|
||||
TexStorage2DMultisample = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLsizei , GLenum , GLsizei , GLsizei , GLboolean )>(context->getProcAddress(QByteArrayLiteral("glTexStorage2DMultisample")));
|
||||
TexBufferRange = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLenum , GLuint , GLintptr , GLsizeiptr )>(context->getProcAddress(QByteArrayLiteral("glTexBufferRange")));
|
||||
TextureView = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLuint , GLenum , GLuint , GLuint , GLuint , GLuint )>(context->getProcAddress(QByteArrayLiteral("glTextureView")));
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
1078
src/gui/opengl/qopengltexturehelper_p.h
Normal file
1078
src/gui/opengl/qopengltexturehelper_p.h
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user