Hi Léo,

On 2/25/20 3:15 PM, Léo Adam wrote:
Hi,

I am new to Qt3D and there's a few things I was wondering how to achieve:

- I need to read and write an opengl texture from C++.
For example, I am rendering a scene into a texture during a first render pass, and then performing some postprocess effect before rendering that texture in a fullscreen quad during a second render pass. I would like to access that texture from C++, and can't manage to do that. I've found the classes /QTextureImageData///QTextureData///QTextureDataGenerator/, but I don't know if that's really what I'm looking for and if it is, how to use it.

Have look at the manual tests in Qt3D https://code.qt.io/cgit/qt/qt3d.git/tree/tests/manual?h=5.15

- texture-updates-cpp -> C++ to GPU uploads

- rendercapture* -> GPU Back buffer / FBO to C++/QML download

- sharedtexture if you want to create a raw OpenGL texture and have Qt3D use it

- deferred-renderer* for rendering into FBO and reusing FBO attachement in a second pass

- I also would like to send preprocessor instructions to a shader from C++/QML and I don't know if this is possible. For example, if I want to use /#ifdef/ in a shader with a value defined in C++, I would need to send that value to the shader just like /QParameter/ do with uniforms. I've searched in the documentation and on internet, but I didn't find anything.

changing the #ifdef would trigger a whole shader recompilation , fine for prototyping, probably not for production.

You would have to modify the shader code directly, something like:

property int value: 1

ShaderProgram {

    fragmentShader: "

        #ifdef " + value + "

            ...

       #else

      ..."

}


Any help would be highly appreciated :-)

Sincerely,
Léo.

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

--
Paul Lemire | paul.lem...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel: France +33 (0)4 90 84 08 53, http://www.kdab.fr
KDAB - The Qt, C++ and OpenGL Experts

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to