2017-04-02 106 views
1

我想使用QOpenGLFramebufferObject渲染到半浮動紋理。 我嘗試創建與下面的代碼FBO:渲染到QOpenGLFramebufferObject GL_HALF_FLOAT

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_HALF_FLOAT GL_RGBA錯誤信息沒有按不會出現,但這不符合我的目的。

如何使用QT渲染到半浮動紋理?

回答

3

通過提供實際的OpenGL圖像格式。 GL_HALF_FLOAT不是圖片格式;這是一個代表類型的枚舉。您可以使用它作爲type in pixel transfer operations,但這不是圖像格式。使用16位浮點數的將爲GL_RGBA16F

+0

謝謝,這工作得很好! –