QOpenGLFramebufferObjectFormat Class

QOpenGLFramebufferObjectFormat 类指定 OpenGL 帧缓冲对象的格式。更多

Header: #include <QOpenGLFramebufferObjectFormat>
CMake: find_package(Qt6 REQUIRED COMPONENTS OpenGL)
target_link_libraries(mytarget PRIVATE Qt6::OpenGL)
qmake: QT += opengl

公共函数

QOpenGLFramebufferObjectFormat()
QOpenGLFramebufferObjectFormat(const QOpenGLFramebufferObjectFormat &other)
~QOpenGLFramebufferObjectFormat()
QOpenGLFramebufferObject::Attachment attachment() const
GLenum internalTextureFormat() const
bool mipmap() const
int samples() const
void setAttachment(QOpenGLFramebufferObject::Attachment attachment)
void setInternalTextureFormat(GLenum internalTextureFormat)
void setMipmap(bool enabled)
void setSamples(int samples)
void setTextureTarget(GLenum target)
GLenum textureTarget() const
bool operator!=(const QOpenGLFramebufferObjectFormat &other) const
QOpenGLFramebufferObjectFormat &operator=(const QOpenGLFramebufferObjectFormat &other)
bool operator==(const QOpenGLFramebufferObjectFormat &other) const

详细说明

帧缓冲对象有几个特征:

请注意,硬件驱动程序可能不支持所需的附件或每个像素的样本数。请在创建QOpenGLFramebufferObject 后调用QOpenGLFramebufferObject::format() 查找用于创建帧缓冲对象的准确格式。

另请参阅 QOpenGLFramebufferObject

成员函数文档

QOpenGLFramebufferObjectFormat::QOpenGLFramebufferObjectFormat()

创建一个 QOpenGLFramebufferObjectFormat 对象,用于指定 OpenGL 帧缓冲对象的格式。

默认情况下,该格式指定了一个无深度/模版附件、纹理目标GL_TEXTURE_2D 和内部格式GL_RGBA8 的非多重采样帧缓冲对象。在 OpenGL/ES 系统上,默认内部格式为GL_RGBA

另请参见 samples()、attachment() 和internalTextureFormat()。

QOpenGLFramebufferObjectFormat::QOpenGLFramebufferObjectFormat(const QOpenGLFramebufferObjectFormat &other)

构造other 的副本。

[noexcept] QOpenGLFramebufferObjectFormat::~QOpenGLFramebufferObjectFormat()

摧毁QOpenGLFramebufferObjectFormat.

QOpenGLFramebufferObject::Attachment QOpenGLFramebufferObjectFormat::attachment() const

返回帧缓冲器对象上的深度缓冲器和模板缓冲器的配置。默认值为QOpenGLFramebufferObject::NoAttachment

另请参见 setAttachment().

GLenum QOpenGLFramebufferObjectFormat::internalTextureFormat() const

返回帧缓冲器对象的纹理或多采样帧缓冲器对象的颜色缓冲器的内部格式。在桌面 OpenGL 系统上默认为GL_RGBA8 ,在 OpenGL/ES 系统上默认为GL_RGBA

另请参阅 setInternalTextureFormat().

bool QOpenGLFramebufferObjectFormat::mipmap() const

如果启用了 mipmapping,则返回true

另请参阅 setMipmap().

int QOpenGLFramebufferObjectFormat::samples() const

如果帧缓冲器对象是多采样帧缓冲器对象,则返回每个像素的采样个数。否则返回 0。默认值为 0。

另请参见 setSamples()。

void QOpenGLFramebufferObjectFormat::setAttachment(QOpenGLFramebufferObject::Attachment attachment)

将帧缓冲器对象的附件配置设置为attachment

另请参阅 attachment() 。

void QOpenGLFramebufferObjectFormat::setInternalTextureFormat(GLenum internalTextureFormat)

将帧缓冲器对象的纹理或多采样帧缓冲器对象的颜色缓冲器的内部格式设置为internalTextureFormat

另请参阅 internalTextureFormat() 。

void QOpenGLFramebufferObjectFormat::setMipmap(bool enabled)

如果enabled 为 true,则启用多点映射;否则禁用多点映射。

默认情况下禁用 mipmapping。

如果启用了 mipmapping,将为 mipmap 级别分配额外的内存。可以通过绑定纹理并调用 glGenerateMipmap() 来更新 mipmap 级别。多采样帧缓冲区对象无法启用 mipmap。

另请参阅 mipmap() 和QOpenGLFramebufferObject::texture()。

void QOpenGLFramebufferObjectFormat::setSamples(int samples)

将多采样帧缓冲器对象的每个像素采样数设置为samples 。默认采样数 0 代表普通的非多采样帧缓冲器对象。

如果硬件不支持所需的每像素采样数,则将使用每像素最大采样数。请注意,多采样帧缓冲器对象不能绑定为纹理。此外,要创建每个像素采样超过一个的帧缓冲,需要使用GL_EXT_framebuffer_multisample 扩展。

另请参阅 samples().

void QOpenGLFramebufferObjectFormat::setTextureTarget(GLenum target)

将帧缓冲器对象上的纹理目标设置为target 。多采样帧缓冲器对象忽略此设置。

另请参阅 textureTarget() 和samples() 。

GLenum QOpenGLFramebufferObjectFormat::textureTarget() const

返回帧缓冲器对象上纹理的目标纹理。多采样帧缓冲器对象忽略。默认值为GL_TEXTURE_2D

另请参阅 setTextureTarget() 和samples()。

bool QOpenGLFramebufferObjectFormat::operator!=(const QOpenGLFramebufferObjectFormat &other) const

如果该帧缓冲器对象格式的所有选项都与other 相同,则返回false ;否则返回true

QOpenGLFramebufferObjectFormat &QOpenGLFramebufferObjectFormat::operator=(const QOpenGLFramebufferObjectFormat &other)

为该对象指定other

bool QOpenGLFramebufferObjectFormat::operator==(const QOpenGLFramebufferObjectFormat &other) const

如果该帧缓冲器对象格式的所有选项都与other 相同,则返回true ;否则返回false

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.