Using existing OpenGL texture in QQuickFramebufferObject
Unsolved
QML and Qt Quick
-
I have some custom OpenGL textures and I want to use them in QQuickFramebufferObject items. All I need is to replace the Qt-created texture by my own, probably by attaching it to the framebuffer object. Here's what I'm currently doing in the render() method:
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, my_texture_id, 0); framebufferObject()->toImage().save("/path/to/image.png");
I test the FBO by saving it in an image and it correctly saves my texture. However, nothing is displayed on the screen.
Is it possible to make the renderer use my texture instead of the one created by QOpenGLFramebuffer object?
I want to avoid creating another FBO with my texture and then blitting it to the Qt Quick FBO because I think that's more expensive (correct me in this if I'm wrong).