quick 3d shader and custom geometry
-
[this topic is also post at Qt6 subcategory: https://forum.qt.io/topic/121710/quick-3d-shader-and-custom-geometry]
Hi, I am using custom shaders and custom geometry in Quick3d of Qt6. I now have 2 questions:
- How to pass a VARYING variable of int type from vertex shader to fragment shader. I need it to be "flat", which is not interpolated.
When I using int type as the above image, I have this shader compiling errors:
I have also tried to add "flat" or "flat in" to the declaration of the "VARYING int patten" and I just couldn't get it right. Can you please give a example of how to use a "VARYING variable" of int type?
2.When I use custom geometry, it seems that I can add custom Semantic to the vertex data, is this right? While I can use "VERTEX" in vertex shader to access the PositionSemantic vetex data, if I can add custom Semantic, then how can I access the custom Semantic data in vertex shader?
If we can't add custom Semantic now, will it be possible to do so in the future version of Qt6?Thanks.
- How to pass a VARYING variable of int type from vertex shader to fragment shader. I need it to be "flat", which is not interpolated.
-
Is this the issue with the int?
-
@fcarney When using normal OpenGL, I know how to pass int variable between vs and ps, just like you mentioned in this the issue . But when it comes to shaders in QtQuick 3D, this isn't right. If I changed the code to the following, I get errors too(see below).
I know that we can definitely pass int type variables from vs to ps, I just don't know how to do that in QtQuick 3D shaders.