9#include <QtGui/qcolor.h>
10#include <QtGui/qopenglcontext.h>
11#include <QtCore/qdebug.h>
12#include <private/qobject_p.h>
13#include <private/qopenglcontext_p.h>
18#if !defined(GL_TEXTURE_WRAP_R)
19 #define GL_TEXTURE_WRAP_R 0x8072
30 requestedMipLevels(1),
35 fixedSamplePositions(true),
44 minLevelOfDetail(-1000.0f),
45 maxLevelOfDetail(1000.0f),
46 levelOfDetailBias(0.0f),
48 autoGenerateMipMaps(true),
49 storageAllocated(
false),
131 qWarning(
"Requires a valid current OpenGL context.\n"
132 "Texture has not been created");
160 if (!currentContext) {
161 qWarning(
"QOpenGLTexturePrivate::destroy() called without a current context.\n"
162 "Texture has not been destroyed");
167 qWarning(
"QOpenGLTexturePrivate::destroy() called but texture context %p"
168 " is not shared with current context %p.\n"
169 "Texture has not been destroyed",
170 static_cast<const void *
>(
context),
171 static_cast<const void *
>(currentContext));
218 GLint oldTextureUnit = 0;
236 GLint oldTextureUnit = 0;
249 GLint boundTextureId = 0;
256 GLint oldTextureUnit = 0;
259 GLint boundTextureId = 0;
434 Q_UNREACHABLE_RETURN(
false);
458 Q_UNREACHABLE_RETURN(
false);
1079 Q_UNREACHABLE_RETURN(
false);
1096 qWarning(
"Buffer textures do not allocate storage");
1105 pixelFormat, pixelType,
nullptr);
1107 qWarning(
"1D textures are not supported");
1120 pixelFormat, pixelType,
nullptr);
1122 qWarning(
"1D array textures are not supported");
1134 pixelFormat, pixelType,
nullptr);
1147 for (
int faceTarget = 0; faceTarget < 6; ++faceTarget) {
1154 pixelFormat, pixelType,
nullptr);
1168 pixelFormat, pixelType,
nullptr);
1170 qWarning(
"Array textures are not supported");
1184 pixelFormat, pixelType,
nullptr);
1186 qWarning(
"Cubemap Array textures are not supported");
1199 pixelFormat, pixelType,
nullptr);
1201 qWarning(
"3D textures are not supported");
1212 qWarning(
"Multisample textures are not supported");
1224 qWarning(
"Multisample array textures are not supported");
1238 qWarning(
"Buffer textures do not allocate storage");
1246 qWarning(
"1D textures are not supported");
1257 qWarning(
"1D array textures are not supported");
1274 qWarning(
"Array textures are not supported");
1285 qWarning(
"Cubemap Array textures are not supported");
1295 qWarning(
"3D textures are not supported");
1306 qWarning(
"Multisample textures are not supported");
1318 qWarning(
"Multisample array textures are not supported");
1338 sourceFormat, sourceType,
data, options);
1347 sourceFormat, sourceType,
data, options);
1358 sourceFormat, sourceType,
data, options);
1368 sourceFormat, sourceType,
data, options);
1379 sourceFormat, sourceType,
data, options);
1389 sourceFormat, sourceType,
data, options);
1400 sourceFormat, sourceType,
data, options);
1413 sourceFormat, sourceType,
data, options);
1420 qWarning(
"QOpenGLTexture::setData(): Texture target does not support pixel data upload");
1427 q->generateMipMaps();
1447 sourceFormat, sourceType,
data, options);
1460 sourceFormat, sourceType,
data, options);
1472 sourceFormat, sourceType,
data, options);
1480 xOffset, yOffset,
layer,
1482 sourceFormat, sourceType,
data, options);
1489 xOffset, yOffset, zOffset,
1491 sourceFormat, sourceType,
data, options);
1502 sourceFormat, sourceType,
data, options);
1511 xOffset, yOffset, layerFace,
1514 sourceFormat, sourceType,
data, options);
1528 sourceFormat, sourceType,
data, options);
1535 qWarning(
"QOpenGLTexture::setData(): Texture target does not support pixel data upload");
1542 q->generateMipMaps();
1553 qWarning(
"Cannot set compressed data for non-compressed format 0x%x",
format);
1564 if (needsFullSpec) {
1578 if (!needsFullSpec) {
1591 if (needsFullSpec) {
1608 if (!needsFullSpec) {
1621 if (needsFullSpec) {
1641 if (needsFullSpec) {
1659 if (!needsFullSpec) {
1675 qWarning(
"QOpenGLTexture::setCompressedData(): Texture target does not support pixel data upload");
1682 q->generateMipMaps();
1731 qWarning(
"QOpenGLTexture::setWrapMode() direction not valid for this texture target");
1755 qWarning(
"QOpenGLTexture::setWrapMode() direction not valid for this texture target");
1793 qWarning(
"QOpenGLTexture::wrapMode() direction not valid for this texture target");
1813 qWarning(
"QOpenGLTexture::wrapMode() direction not valid for this texture target");
1838 int minimumMipmapLevel,
int maximumMipmapLevel,
1839 int minimumLayer,
int maximumLayer)
const
1844 bool viewTargetCompatible =
false;
1886 if (!viewTargetCompatible) {
1887 qWarning(
"QOpenGLTexture::createTextureView(): Incompatible source and view targets");
1892 bool viewFormatCompatible =
false;
2015 viewFormatCompatible = (viewFormat ==
format);
2019 if (!viewFormatCompatible) {
2020 qWarning(
"QOpenGLTexture::createTextureView(): Incompatible source and view formats");
2027 view->setFormat(viewFormat);
2031 minimumMipmapLevel, maximumMipmapLevel - minimumMipmapLevel + 1,
2032 minimumLayer, maximumLayer - minimumLayer + 1);
2516 return d->destroy();
2527 return d->textureId != 0;
2539 return d->textureId;
2611 return d->isBound();
2624 return d->isBound(unit);
2635 qWarning(
"QOpenGLTexture::boundTextureId() requires a valid current context");
2652 qWarning(
"QOpenGLTexture::boundTextureId() requires a valid current context");
2657 funcs->initializeOpenGLFunctions();
2659 GLint oldTextureUnit = 0;
2662 funcs->glActiveTexture(unit);
2665 funcs->glActiveTexture(oldTextureUnit);
2684 qWarning(
"QOpenGLTexture::setFormat(): Cannot change format once storage has been allocated");
2907 qWarning(
"Cannot resize a texture that already has storage allocated.\n"
2908 "To do so, destroy() the texture and then create() and setSize()");
2915 switch (
d->target) {
2919 d->dimensions[0] =
width;
2929 d->dimensions[0] =
width;
2937 qWarning(
"QAbstractOpenGLTexture::setSize(): Cube map textures must be square");
2938 d->dimensions[0] =
d->dimensions[1] =
width;
2943 d->dimensions[0] =
width;
2945 d->dimensions[2] =
depth;
2958 return d->dimensions[0];
2969 return d->dimensions[1];
2980 return d->dimensions[2];
2999 qWarning(
"Cannot set mip levels on a texture that already has storage allocated.\n"
3000 "To do so, destroy() the texture and then create() and setMipLevels()");
3004 switch (
d->target) {
3012 d->requestedMipLevels =
levels;
3019 qWarning(
"QAbstractOpenGLTexture::setMipLevels(): This texture target does not support mipmaps");
3046 return d->maximumMipLevelCount();
3063 qWarning(
"Cannot set layers on a texture that already has storage allocated.\n"
3064 "To do so, destroy() the texture and then create() and setLayers()");
3068 switch (
d->target) {
3083 qWarning(
"Texture target does not support array layers");
3131 qWarning(
"Cannot set sample count on a texture that already has storage allocated.\n"
3132 "To do so, destroy() the texture and then create() and setSamples()");
3136 switch (
d->target) {
3152 qWarning(
"Texture target does not support multisampling");
3193 qWarning(
"Cannot set sample positions on a texture that already has storage allocated.\n"
3194 "To do so, destroy() the texture and then create() and setFixedSamplePositions()");
3198 switch (
d->target) {
3201 d->fixedSamplePositions = fixed;
3214 qWarning(
"Texture target does not support multisampling");
3232 return d->fixedSamplePositions;
3267 d->allocateStorage(pixelFormat, pixelType);
3297 d->allocateStorage(pixelFormat, pixelType);
3312 return d->storageAllocated;
3349 int minimumMipmapLevel,
int maximumMipmapLevel,
3350 int minimumLayer,
int maximumLayer)
const
3354 qWarning(
"Cannot set create a texture view of a texture that does not have storage allocated.");
3357 Q_ASSERT(maximumMipmapLevel >= minimumMipmapLevel);
3358 Q_ASSERT(maximumLayer >= minimumLayer);
3359 return d->createTextureView(
target, viewFormat,
3360 minimumMipmapLevel, maximumMipmapLevel,
3361 minimumLayer, maximumLayer);
3374 return d->textureView;
3400 qWarning(
"Cannot set data on a texture that does not have storage allocated.\n"
3401 "To do so call allocateStorage() before this function");
3404 d->setData(mipLevel,
layer, 1, cubeFace, sourceFormat, sourceType,
data, options);
3419 qWarning(
"Cannot set data on a texture that does not have storage allocated.\n"
3420 "To do so call allocateStorage() before this function");
3423 d->setData(mipLevel,
layer, layerCount, cubeFace, sourceFormat, sourceType,
data, options);
3484 d->setData(xOffset, yOffset, zOffset,
3488 sourceType,
data, options);
3513 d->setData(xOffset, yOffset, zOffset,
3517 sourceType,
data, options);
3536 int mipLevel,
int layer,
3542 d->setData(xOffset, yOffset, zOffset,
3546 sourceType,
data, options);
3566 int mipLevel,
int layer,
3573 d->setData(xOffset, yOffset, zOffset,
3577 sourceType,
data, options);
3597 int mipLevel,
int layer,
3604 d->setData(xOffset, yOffset, zOffset,
3606 mipLevel,
layer, layerCount,
3608 sourceType,
data, options);
3625 qWarning(
"QOpenGLTexture::setData() requires a valid current context");
3629 if (
image.isNull()) {
3630 qWarning(
"QOpenGLTexture::setData() tried to set a null image");
3636 qWarning(
"QOpenGLTexture::setData() failed to convert image");
3640 if (
context->isOpenGLES() &&
context->format().majorVersion() < 3)
3672 qWarning(
"Cannot set data on a texture that does not have storage allocated.\n"
3673 "To do so call allocateStorage() before this function");
3691 qWarning(
"Cannot set data on a texture that does not have storage allocated.\n"
3692 "To do so call allocateStorage() before this function");
3695 d->setCompressedData(mipLevel,
layer, layerCount, cubeFace,
dataSize,
data, options);
3739 qWarning(
"QOpenGLTexture::hasFeature() requires a valid current context");
3745 bool supported =
false;
3747#if !QT_CONFIG(opengles2)
3748 if (!
ctx->isOpenGLES()) {
3832 if (
ctx->isOpenGLES())
3835 const char *
renderer =
reinterpret_cast<const char *
>(
ctx->functions()->glGetString(GL_RENDERER));
3917 qWarning(
"QOpenGLTexture::setMipBaseLevel: requires OpenGL >= 1.2 or OpenGL ES >= 3.0");
3922 Q_ASSERT(baseLevel <= d->maxLevel);
3923 d->baseLevel = baseLevel;
3936 return d->baseLevel;
3950 qWarning(
"QOpenGLTexture::setMipMaxLevel: requires OpenGL >= 1.2 or OpenGL ES >= 3.0");
3956 d->maxLevel = maxLevel;
3983 qWarning(
"QOpenGLTexture::setMipLevelRange: requires OpenGL >= 1.2 or OpenGL ES >= 3.0");
4028 return d->autoGenerateMipMaps;
4048 if (
ctx->isOpenGLES())
4051 d->texFuncs->glGenerateTextureMipmap(
d->textureId,
d->target,
d->bindingTarget);
4073 if (
ctx->isOpenGLES())
4080 d->texFuncs->glGenerateTextureMipmap(
d->textureId,
d->target,
d->bindingTarget);
4099#if !defined(Q_OS_MAC) && !QT_CONFIG(opengles2)
4105 if (!
d->features.testFlag(
Swizzle)) {
4106 qWarning(
"QOpenGLTexture::setSwizzleMask() requires OpenGL >= 3.3");
4110 d->texFuncs->glTextureParameteri(
d->textureId,
d->target,
d->bindingTarget,
component,
value);
4117 qWarning(
"QOpenGLTexture: Texture swizzling is not supported");
4128#if !defined(Q_OS_MAC) && !QT_CONFIG(opengles2)
4134 if (!
d->features.testFlag(
Swizzle)) {
4135 qWarning(
"QOpenGLTexture::setSwizzleMask() requires OpenGL >= 3.3");
4139 d->swizzleMask[0] =
r;
4140 d->swizzleMask[1] =
g;
4141 d->swizzleMask[2] =
b;
4142 d->swizzleMask[3] =
a;
4152 qWarning(
"QOpenGLTexture: Texture swizzling is not supported");
4188#if !defined(Q_OS_MAC) && !QT_CONFIG(opengles2)
4195 qWarning(
"QOpenGLTexture::setDepthStencilMode() requires OpenGL >= 4.3 or GL_ARB_stencil_texturing");
4198 d->depthStencilMode =
mode;
4205 qWarning(
"QOpenGLTexture: DepthStencil Mode is not supported");
4217 return d->depthStencilMode;
4251 qWarning(
"QOpenGLTexture::setComparisonFunction: requires OpenGL >= 1.5 or OpenGL ES >= 3.0");
4269 return d->comparisonFunction;
4294 qWarning(
"QOpenGLTexture::setComparisonMode: requires OpenGL >= 1.5 or OpenGL ES >= 3.0");
4297 d->comparisonMode =
mode;
4312 return d->comparisonMode;
4327 d->texFuncs->glTextureParameteri(
d->textureId,
d->target,
d->bindingTarget, GL_TEXTURE_MIN_FILTER,
filter);
4338 return d->minFilter;
4353 d->texFuncs->glTextureParameteri(
d->textureId,
d->target,
d->bindingTarget, GL_TEXTURE_MAG_FILTER,
filter);
4364 return d->magFilter;
4382 d->texFuncs->glTextureParameteri(
d->textureId,
d->target,
d->bindingTarget, GL_TEXTURE_MIN_FILTER,
minificationFilter);
4383 d->texFuncs->glTextureParameteri(
d->textureId,
d->target,
d->bindingTarget, GL_TEXTURE_MAG_FILTER,
magnificationFilter);
4410 qWarning(
"QOpenGLTexture::setMaximumAnisotropy() requires GL_EXT_texture_filter_anisotropic");
4413 d->maxAnisotropy = anisotropy;
4426 return d->maxAnisotropy;
4440 d->setWrapMode(
mode);
4476 static_cast<float>(
color.blueF()),
static_cast<float>(
color.alphaF()));
4486#if !QT_CONFIG(opengles2)
4497 d->borderColor.clear();
4498 for (
int i = 0;
i < 4; ++
i)
4500 d->texFuncs->glTextureParameterfv(
d->textureId,
d->target,
d->bindingTarget, GL_TEXTURE_BORDER_COLOR,
values);
4509 qWarning(
"QOpenGLTexture: Border color is not supported");
4519#if !QT_CONFIG(opengles2)
4530 d->borderColor.clear();
4531 for (
int i = 0;
i < 4; ++
i)
4533 d->texFuncs->glTextureParameteriv(
d->textureId,
d->target,
d->bindingTarget, GL_TEXTURE_BORDER_COLOR,
values);
4542 qWarning(
"QOpenGLTexture: Border color is not supported");
4554#if !QT_CONFIG(opengles2)
4565 d->borderColor.clear();
4566 for (
int i = 0;
i < 4; ++
i)
4568 d->texFuncs->glTextureParameteriv(
d->textureId,
d->target,
d->bindingTarget, GL_TEXTURE_BORDER_COLOR,
values);
4577 qWarning(
"QOpenGLTexture: Border color is not supported");
4590 QColor c(0.0f, 0.0f, 0.0f, 0.0f);
4591 if (!
d->borderColor.isEmpty()) {
4592 c.setRedF(
d->borderColor.at(0).toFloat());
4593 c.setGreenF(
d->borderColor.at(1).toFloat());
4594 c.setBlueF(
d->borderColor.at(2).toFloat());
4595 c.setAlphaF(
d->borderColor.at(3).toFloat());
4610 if (
d->borderColor.isEmpty()) {
4611 for (
int i = 0;
i < 4; ++
i)
4614 for (
int i = 0;
i < 4; ++
i)
4615 border[
i] =
d->borderColor.at(
i).toFloat();
4629 if (
d->borderColor.isEmpty()) {
4630 for (
int i = 0;
i < 4; ++
i)
4633 for (
int i = 0;
i < 4; ++
i)
4634 border[
i] =
d->borderColor.at(
i).toInt();
4648 if (
d->borderColor.isEmpty()) {
4649 for (
int i = 0;
i < 4; ++
i)
4652 for (
int i = 0;
i < 4; ++
i)
4653 border[
i] =
d->borderColor.at(
i).toUInt();
4666#if !QT_CONFIG(opengles2)
4672 Q_ASSERT(value < d->maxLevelOfDetail);
4673 d->minLevelOfDetail =
value;
4680 qWarning(
"QOpenGLTexture: Detail level is not supported");
4691 return d->minLevelOfDetail;
4703#if !QT_CONFIG(opengles2)
4710 d->maxLevelOfDetail =
value;
4717 qWarning(
"QOpenGLTexture: Detail level is not supported");
4728 return d->maxLevelOfDetail;
4739#if !QT_CONFIG(opengles2)
4746 d->minLevelOfDetail = min;
4747 d->maxLevelOfDetail = max;
4756 qWarning(
"QOpenGLTexture: Detail level is not supported");
4767 return qMakePair(
d->minLevelOfDetail,
d->maxLevelOfDetail);
4781#if !QT_CONFIG(opengles2)
4787 d->levelOfDetailBias =
bias;
4794 qWarning(
"QOpenGLTexture: Detail level is not supported");
4805 return d->levelOfDetailBias;
4808#ifndef QT_NO_DEBUG_STREAM
4813 debug <<
"QOpenGLTexture(";
4816 debug <<
d->target <<
", bindingTarget=" <<
d->bindingTarget
4817 <<
", size=[" <<
d->dimensions[0]
4818 <<
", " <<
d->dimensions[1];
4820 debug <<
", " <<
d->dimensions[2];
4821 debug <<
"], format=" <<
d->format <<
", formatClass=" <<
d->formatClass;
4823 debug <<
", textureId=" <<
d->textureId;
4825 debug <<
", [bound]";
4826 if (
t->isTextureView())
4827 debug <<
", [view]";
4828 if (
d->fixedSamplePositions)
4829 debug <<
", [fixedSamplePositions]";
4830 debug <<
", mipLevels=" <<
d->requestedMipLevels <<
", layers=" <<
d->layers
4831 <<
", faces=" <<
d->faces <<
", samples=" <<
d->samples
4832 <<
", depthStencilMode=" <<
d->depthStencilMode <<
", comparisonFunction="
4833 <<
d->comparisonFunction <<
", comparisonMode=" <<
d->comparisonMode
4834 <<
", features=" <<
d->features <<
", minificationFilter=" <<
d->minFilter
4835 <<
", magnificationFilter=" <<
d->magFilter <<
", wrapMode=" <<
d->wrapModes[0];
4846#include "moc_qopengltexture.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
bool isNull() const
Returns true if it is a null image, otherwise returns false.
const uchar * constBits() const
Returns a pointer to the first pixel data.
QScopedPointer< QObjectData > d_ptr
static QOpenGLContext * currentContext()
Returns the last context which called makeCurrent in the current thread, or \nullptr,...
static bool areSharing(QOpenGLContext *first, QOpenGLContext *second)
Returns true if the first and second contexts are sharing OpenGL resources.
The QOpenGLFunctions class provides cross-platform access to the OpenGL ES 2.0 API.
void glGenTextures(GLsizei n, GLuint *textures)
Convenience function that calls glGenTextures(n, textures).
void glBindTexture(GLenum target, GLuint texture)
Convenience function that calls glBindTexture(target, texture).
void glDeleteTextures(GLsizei n, const GLuint *textures)
Convenience function that calls glDeleteTextures(n, textures).
void glGetIntegerv(GLenum pname, GLint *params)
Convenience function that calls glGetIntegerv(pname, params).
void setAlignment(int alignment)
Sets the alignment requirements for each pixel row.
void glTextureStorage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height)
void glTextureView(GLuint texture, GLenum target, GLuint origTexture, GLenum internalFormat, GLuint minLevel, GLuint numLevels, GLuint minLayer, GLuint numLayers)
void glCompressedTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits, const QOpenGLPixelTransferOptions *const options=nullptr)
void glTextureStorage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
void glTextureImage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
void glActiveTexture(GLenum texture)
void glTextureStorage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width)
void glTextureImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
void glTextureImage3DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations)
void glTextureStorage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth)
void glTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
void glCompressedTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits, const QOpenGLPixelTransferOptions *const options=nullptr)
void glCompressedTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits, const QOpenGLPixelTransferOptions *const options=nullptr)
void glTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const QOpenGLPixelTransferOptions *const options=nullptr)
void glCompressedTextureSubImage2D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits, const QOpenGLPixelTransferOptions *const options=nullptr)
void glTextureImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
void glTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, const QOpenGLPixelTransferOptions *const options=nullptr)
void glCompressedTextureImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits, const QOpenGLPixelTransferOptions *const options=nullptr)
void glTextureStorage2DMultisample(GLuint texture, GLenum target, GLenum bindingTarget, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations)
void glCompressedTextureSubImage3D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits, const QOpenGLPixelTransferOptions *const options=nullptr)
void glTextureParameteri(GLuint texture, GLenum target, GLenum bindingTarget, GLenum pname, GLint param)
void glTextureSubImage1D(GLuint texture, GLenum target, GLenum bindingTarget, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const QOpenGLPixelTransferOptions *const options=nullptr)
QOpenGLTexture::BindingTarget bindingTarget
QOpenGLTexture::SwizzleValue swizzleMask[4]
QOpenGLTexture::WrapMode wrapMode(QOpenGLTexture::CoordinateDirection direction) const
void allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType)
int evaluateMipLevels() const
QOpenGLTexture::Filter minFilter
void setData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options)
QOpenGLFunctions * functions
bool isUsingImmutableStorage() const
QOpenGLTexture::Filter magFilter
QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget, QOpenGLTexture *qq)
QOpenGLTexture::WrapMode wrapModes[3]
void allocateImmutableStorage()
void allocateMutableStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType)
void setWrapMode(QOpenGLTexture::WrapMode mode)
int maximumMipLevelCount() const
bool fixedSamplePositions
QOpenGLTexture::DepthStencilMode depthStencilMode
QOpenGLTexture::Features features
QOpenGLTexture * createTextureView(QOpenGLTexture::Target target, QOpenGLTexture::TextureFormat viewFormat, int minimumMipmapLevel, int maximumMipmapLevel, int minimumLayer, int maximumLayer) const
void initializeOpenGLFunctions()
void setCompressedData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions *const options)
static int mipLevelSize(int mipLevel, int baseLevelSize)
QOpenGLTextureHelper * texFuncs
QOpenGLTexture::TextureFormat format
QOpenGLTexture::TextureFormatClass formatClass
int width() const
Returns the width of a 1D, 2D or 3D texture.
TextureFormat
This enum defines the possible texture formats.
@ SRGB8_Alpha8_ASTC_10x10
@ SRGB8_Alpha8_ASTC_12x12
@ SRGB8_PunchThrough_Alpha1_ETC2
@ RGB8_PunchThrough_Alpha1_ETC2
@ SRGB8_Alpha8_ASTC_12x10
void release()
Unbinds this texture from the currently active texture unit.
int depth() const
Returns the depth of a 3D texture.
@ FormatClass_S3TC_DXT5_RGBA
@ FormatClass_S3TC_DXT1_RGBA
@ FormatClass_S3TC_DXT1_RGB
@ FormatClass_S3TC_DXT3_RGBA
bool isBound() const
Returns true if this texture is bound to the corresponding target of the currently active texture uni...
void setSwizzleMask(SwizzleComponent component, SwizzleValue value)
GLSL shaders are able to reorder the components of the vec4 returned by texture functions.
void setMipLevels(int levels)
For texture targets that support mipmaps, this function sets the requested number of mipmap levels to...
static bool hasFeature(Feature feature)
Returns true if your OpenGL implementation and version supports the texture feature feature.
void setMaximumLevelOfDetail(float value)
Sets the maximum level of detail to value.
float maximumLevelOfDetail() const
Returns the maximum level of detail parameter.
Filter
This enum defines the filtering parameters for a QOpenGLTexture object.
WrapMode wrapMode(CoordinateDirection direction) const
Returns the wrap mode for the texture dimension direction.
bool isAutoMipMapGenerationEnabled() const
Returns whether auto mipmap generation is enabled for this texture object.
void setLevelofDetailBias(float bias)
Sets the level of detail bias to bias.
void setFormat(TextureFormat format)
Sets the format of this texture object to format.
void setWrapMode(WrapMode mode)
Sets the wrap (or repeat mode) for all texture dimensions to mode.
TextureFormat format() const
Returns the format of this texture object.
MipMapGeneration
This enum defines the options to control mipmap generation.
int faces() const
Returns the number of faces for this texture.
void setMipMaxLevel(int maxLevel)
Sets the maximum mipmap level used for all texture lookups with this texture to maxLevel.
int mipBaseLevel() const
Returns the mipmap base level used for all texture lookups with this texture.
WrapMode
This enum defines the possible texture coordinate wrapping modes.
void setMipLevelRange(int baseLevel, int maxLevel)
Sets the range of mipmap levels that can be used for texture lookups with this texture to range from ...
void setMinMagFilters(Filter minificationFilter, Filter magnificationFilter)
Sets the minification filter to minificationFilter and the magnification filter to magnificationFilte...
DepthStencilMode depthStencilMode() const
Returns the depth stencil mode for textures using a combined depth/stencil format.
int samples() const
Returns the number of multisample sample points for this texture.
ComparisonMode comparisonMode() const
void setComparisonMode(ComparisonMode mode)
bool isStorageAllocated() const
Returns true if server-side storage for this texture as been allocated.
QPair< Filter, Filter > minMagFilters() const
Returns the current minification and magnification filters.
void setMinificationFilter(Filter filter)
Sets the filter used for minification to filter.
bool isCreated() const
Returns true if the underlying OpenGL texture object has been created.
SwizzleValue
This enum defines the possible mask values for texture swizzling.
QPair< int, int > mipLevelRange() const
Returns the range of mipmap levels that can be used for texture lookups with this texture.
void setAutoMipMapGenerationEnabled(bool enabled)
If enabled is true, enables automatic mipmap generation for this texture object to occur whenever the...
void setMipBaseLevel(int baseLevel)
Sets the base mipmap level used for all texture lookups with this texture to baseLevel.
QOpenGLTexture(Target target)
Creates a QOpenGLTexture object that can later be bound to target.
void destroy()
Destroys the underlying OpenGL texture object.
void setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
Uploads compressed pixel data to mipLevel, array layer, and cubeFace.
float levelofDetailBias() const
Returns the level of detail bias parameter.
QColor borderColor() const
Returns the borderColor of this texture.
void setLevelOfDetailRange(float min, float max)
Sets the minimum level of detail parameters to min and the maximum level to max.
void setComparisonFunction(ComparisonFunction function)
bool isFixedSamplePositions() const
Returns whether this texture uses a fixed pattern of multisample samples.
void setMaximumAnisotropy(float anisotropy)
If your OpenGL implementation supports the GL_EXT_texture_filter_anisotropic extension this function ...
CubeMapFace
This enum defines the possible CubeMap faces.
BindingTarget
This enum defines the possible binding targets of texture units.
@ BindingTarget2DMultisampleArray
@ BindingTarget2DMultisample
@ BindingTargetCubeMapArray
Filter magnificationFilter() const
Returns the magnification filter.
Filter minificationFilter() const
Returns the minification filter.
void setMinimumLevelOfDetail(float value)
Sets the minimum level of detail to value.
PixelType
This enum defines the possible pixel data types for a pixel transfer operation.
@ Float32_D32_UInt32_S8_X24
void setFixedSamplePositions(bool fixed)
Sets whether the sample positions and number of samples used with a multisample capable texture targe...
Target
This enum defines the texture target of a QOpenGLTexture object.
@ Target2DMultisampleArray
int height() const
Returns the height of a 2D or 3D texture.
bool create()
Creates the underlying OpenGL texture object.
void allocateStorage()
Allocates server-side storage for this texture object taking into account, the format,...
QPair< float, float > levelOfDetailRange() const
Returns the minimum and maximum level of detail parameters.
int mipLevels() const
Returns the number of mipmap levels for this texture.
void setLayers(int layers)
Sets the number of array layers to allocate storage for.
Target target() const
Returns the binding target of this texture.
static GLuint boundTextureId(BindingTarget target)
Returns the textureId of the texture that is bound to the target of the currently active texture unit...
void setMagnificationFilter(Filter filter)
Sets the magnification filter to filter.
float maximumAnisotropy() const
Returns the maximum level of anisotropy to be accounted for when performing texture lookups.
void bind()
Binds this texture to the currently active texture unit ready for rendering.
SwizzleValue swizzleMask(SwizzleComponent component) const
Returns the swizzle mask for texture component.
float minimumLevelOfDetail() const
Returns the minimum level of detail parameter.
PixelFormat
This enum defines the possible client-side pixel formats for a pixel transfer operation.
void setBorderColor(const QColor &color)
Sets the border color of the texture to color.
int mipMaxLevel() const
Returns the mipmap maximum level used for all texture lookups with this texture.
GLuint textureId() const
Returns the name of the underlying OpenGL texture object or 0 if it has not yet been created.
int maximumMipLevels() const
Returns the maximum number of mipmap levels that this texture can have given the current dimensions.
void setData(int mipLevel, int layer, CubeMapFace cubeFace, PixelFormat sourceFormat, PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions *const options=nullptr)
Uploads pixel data for this texture object mipLevel, array layer, and cubeFace.
void setDepthStencilMode(DepthStencilMode mode)
If using a texture that has a combined depth/stencil format this function sets which component of the...
void setSize(int width, int height=1, int depth=1)
Sets the dimensions of this texture object to width, height, and depth.
ComparisonFunction comparisonFunction() const
QOpenGLTexture * createTextureView(Target target, TextureFormat viewFormat, int minimumMipmapLevel, int maximumMipmapLevel, int minimumLayer, int maximumLayer) const
Attempts to create a texture view onto this texture.
SwizzleComponent
This enum defines the texture color components that can be assigned a swizzle mask.
Feature
This enum defines the OpenGL texture-related features that can be tested for.
@ ImmutableMultisampleStorage
@ TextureComparisonOperators
TextureUnitReset
This enum defines options ot control texture unit activation.
int layers() const
Returns the number of array layers for this texture.
CoordinateDirection
This enum defines the possible texture coordinate directions.
void setSamples(int samples)
Sets the number of samples to allocate storage for when rendering to a multisample capable texture ta...
void generateMipMaps()
Generates mipmaps for this texture object from mipmap level 0.
bool isTextureView() const
Returns true if this texture object is actually a view onto another texture object.
static VulkanServerBufferGlFunctions * funcs
Combined button and popup list for selecting options.
#define QByteArrayLiteral(str)
std::pair< T1, T2 > QPair
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
const EGLAttrib EGLOutputLayerEXT * layers
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
#define GL_TEXTURE_MAX_ANISOTROPY_EXT
GLenum GLsizei GLsizei GLint * values
[15]
GLboolean GLboolean GLboolean b
GLenum GLsizeiptr const void GLsizei faceIndex
typedef GLint(GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC)(GLuint program
GLint GLenum GLsizei GLsizei GLsizei depth
GLenum GLuint GLint level
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
GLsizei GLenum internalFormat
#define GL_TEXTURE_COMPARE_FUNC
#define GL_DEPTH_STENCIL_TEXTURE_MODE
#define GL_TEXTURE_WRAP_R
#define GL_TEXTURE_BASE_LEVEL
#define GL_TEXTURE_LOD_BIAS
#define GL_TEXTURE_MAX_LEVEL
#define GL_ACTIVE_TEXTURE
#define GL_TEXTURE_SWIZZLE_RGBA
GLdouble GLdouble GLdouble GLdouble q
#define GL_TEXTURE_MAX_LOD
#define GL_TEXTURE_MIN_LOD
#define GL_TEXTURE_COMPARE_MODE
static QOpenGLTexture::PixelFormat pixelFormatCompatibleWithInternalFormat(QOpenGLTexture::TextureFormat internalFormat)
static QOpenGLTexture::PixelType pixelTypeCompatibleWithInternalFormat(QOpenGLTexture::TextureFormat internalFormat)
static bool isNpot(int width, int height=1, int depth=1)
static bool isCompressedFormat(QOpenGLTexture::TextureFormat internalFormat)
static bool isTextureTargetMultisample(QOpenGLTexture::Target target)
static bool isSizedTextureFormat(QOpenGLTexture::TextureFormat internalFormat)
QDebug operator<<(QDebug debug, const QOpenGLTexture *t)
constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
static qreal component(const QPointF &point, unsigned int i)
QSvgRenderer * renderer
[0]