我想使用 QOpenGLFramebufferObject 渲染为半浮点纹理。我尝试使用以下代码创建 fbo:
structureTensorTexture = new QOpenGLFramebufferObject(
renderWidth,
renderHeight,
QOpenGLFramebufferObject::NoAttachment,
GL_TEXTURE_2D,
GL_HALF_FLOAT
);
但是当我运行程序时,控制台中会出现以下消息:
[openglqopenglframebufferobject.cpp line 544] OpenGL Error: 1280
QOpenGLFramebufferObject: Framebuffer incomplete attachment.
QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment.
如果我使用 GL_RGBA 而不是GL_HALF_FLOAT则不会出现错误消息,但这不符合我的目的。
如何使用 QT 渲染为半浮动纹理?
通过提供实际的 OpenGL 图像格式。 GL_HALF_FLOAT
不是图像格式;它是一个表示类型的枚举。您可以将其用作像素传输操作中的type
,但这不是图像格式。
使用 16 位浮点数的图像格式将GL_RGBA16F
.