Generating Quick3D materials interactively
-
Greetings.
I have just spent 2 months learning from scratch to port a working Qt application I have been working on from QT5 using QWidgets to to define the UI, to QT6 using QML as the basis of the UI. I like the QML approach as it dispenses all of the hassles of signals and slots house keeping in QWidgets.
However, the original reason for moving to QML was an expectation of displaying and managing 3D graphics would be much easier to manage than using the QOpenGLWidget and other associated opengl classes, and it is.
But now I have a problem, and it is to do with creating custom materials using QML, or rather QtQuick3D custom material QML type.
It seems that generating the custom material through use of the QML specific intermediate vertex and fragment shader code files, and compiling the shader code is done at starting the application. Any modifications made to these "shader" files with the intent of recompiling them, and then using this updated shader program without exiting and restarting the QML application does not seem possible. My experiments to do this have failed.
In my original application, this is possible, and it is designed that way so that a user can modify or select different shader code, (including geometry shader code) to be compiled and used to display point cloud data in whatever manner the user wishes . It is also so the user can interactively correct code errors.
Does Quick3D allow recompilation of the vertex and fragment shader code to be performed and redisplay the image on screen through an update call without exiting the application and restarting it?
If so, how is this done as I cannot find any kind of "shader" compile command in the documentation ?
Thanks for any help in advance, much appreciated if any can be given.
-
Well this was simple. After going into the source code, I noticed a onVertexShader changed signal or something of that nature and then I noticed an update command.
How stupid of me. Of coarse. An update command is given in any openGL code to redraw the scene. So a simple update call in a function call is all that is needed.
Now for the bigger problem. It appears that quick3D can only handle vertex and fragment shaders, and a large part of what I required shader wise is to be able to use a geometry shader to convert point data into some other shape and manipulate it interactively in real time. A bummer as the alternative Qt3D which seems more flexible and thorough to do all things 3D is quite impractical to try and implement. A combination of poor and sparse documentation with trivial examples that show little on how to expand them. The exact reason I have not tried to use other frameworks
Qt3D. It seems there are all the parts to build a car, but little to no instructions on how to do it !