Hello there, long time since my last post here!
I was reading a little bit about geometry shaders here, and after finding out that there’s support in shadestyle for them, I decided to give it a try .
I tried a simple application, namely transform a LINE primitive type into a pair of triangles forming a rectangle to achieve a “widened” line.
Here’s some little code
If you run the code, you’ll notice that while the vertex and fragment shaders are correctly run, the geometry shader seems not to be called. To check this, just remove one of those precious semi-columns in the geometryTransform string, and you’ll see that the code still runs with no error, making me think the string is indeed not added to the graphic pipeline.
I have the feeling that drawer.vertexBuffer might not be the right place to use a geometry shader, but I couldn’t figure it out from the source code.
Has anyone successfully used geometry shaders in openRNDR?
In the orx demo folder there’s just one example for geometry shaders:
I remember trying it but couldn’t make full sense of it.
I still have a bunch of uncommitted changes / tests to the three gs shader files from that example.
Maybe now that it’s fresh for you, could you take a look at that demo and see if it works? Adding some comments would be super welcome too
Hello!
I have given a look at the code: the geometry shader there is “transparent”, namely it emits the exact same geometry, and doesn’t produce any new information.
Here I have modified the example
This time what will happen is that a wireframe of the box mesh is produced, and the color attribute is changed by the geometry shader itself. In other words, the geometry shader receives a triangle primitive, and produces a line strip primitive, with varying colors of the vertices.
Notice the the position transformation is now delegated to the geometry shader: this is due to the fact that the color should stick to the vertex itself, and not to its view coordinates, otherwise when rotating the cube the color “would not follow”.
Maybe I could add to the guide something about geometry shaders and their usage…
Neverthless, this still does not address the point of how to use geometry shaders in shadestyle, since in this example the Shader class and Driver class are used instead.