QOpenGLFramebufferObjectFormat Class
QOpenGLFramebufferObjectFormat 类指定了 OpenGL 帧缓冲区对象的格式。更多内容...
| 头文件: | #include <QOpenGLFramebufferObjectFormat> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS OpenGL) target_link_libraries(mytarget PRIVATE Qt6::OpenGL) |
| qmake: | QT += opengl |
- 所有成员的列表,包括继承的成员
- QOpenGLFramebufferObjectFormat 属于“3D渲染”类。
公共函数
| 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 |
详细说明
帧缓冲区对象具有以下几个特征:
- Number of samples per pixels.
- Depth and/or stencil attachments.
- Texture target.
- Internal texture format.
请注意,所需的附加项或每像素的采样数可能不受硬件驱动程序支持。在创建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
如果启用了MIP映射,则返回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,则启用Mip映射;否则禁用。
默认情况下,Mip映射处于禁用状态。
如果启用了 Mipmapping,系统将为 Mipmap 级别分配额外的内存。可以通过绑定纹理并调用 glGenerateMipmap() 来更新 Mipmap 级别。对于多采样帧缓冲区对象,无法启用 Mipmapping。
另请参阅 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 。
© 2026 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.