gpt4 book ai didi

c++ - 渲染到 QOpenGLFramebufferObject GL_HALF_FLOAT

转载 作者:行者123 更新时间:2023-11-30 02:26:11 26 4
gpt4 key购买 nike

我想使用 QOpenGLFramebufferObject 渲染到半浮点纹理。我尝试使用以下代码创建 fbo:

structureTensorTexture = new QOpenGLFramebufferObject(
renderWidth,
renderHeight,
QOpenGLFramebufferObject::NoAttachment,
GL_TEXTURE_2D,
GL_HALF_FLOAT
);

但是当我运行该程序时,此消息出现在控制台中:

[opengl\qopenglframebufferobject.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 in pixel transfer operations ,但这不是图像格式。

image format使用 16 位 float 的将是 GL_RGBA16F

关于c++ - 渲染到 QOpenGLFramebufferObject GL_HALF_FLOAT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43173271/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com