[2.1] Multiple Geometry Shaders (for different primitives)
Posted: Wed Oct 31, 2018 10:11 am
Render System: GL3Plus
Hello!
Realized I have a second question regarding geometry shaders and figured I may as well make a new post.
As mentioned in my previous post I am using a geometry shader to implement line thickness for lines, but turning them into quads in screenspace.
This works fine but when I render something other than lines using that specific Hlms (my own version of Unlit in this case) it renders nothing.
I'm assuming that because the geometry shader specifices what type of primitive it handles it discards all others.
Ideally it would just pass-through other primitives that do not match the layout qualifer (layout(lines) in;)
After searching the internet it seems I should create different geometry shaders for the different types of primitives I want to use.
So for triangles I basically just want to pass-through and for points I want to do similar thickness stuff.
My question is: How do I tell Ogre to use the different geometry shaders (in a single Hlms)?
To get the one I have working I simply created a GeometryShader_gs.glsl file and it compiled and used it automatically. So I'm guessing there is something telling Ogre to look for that file. As for the other shader types this is done for each Hlms type, but I would prefer not adding a new Hlms just to be able to render other types or primitives, that seems overkill.
Edit: I suppose it could be done by having datablocks define what shader they need, but again that would mean specific datablocks only work for specific primitives, which doesn't seem like a relation that should be required. It would also mean I need to create many new datablocks. The best would be if it could just automatically switch geometry shader based on the type of primitive.
If there is a different/better solution let me know!
Hello!
Realized I have a second question regarding geometry shaders and figured I may as well make a new post.
As mentioned in my previous post I am using a geometry shader to implement line thickness for lines, but turning them into quads in screenspace.
This works fine but when I render something other than lines using that specific Hlms (my own version of Unlit in this case) it renders nothing.
I'm assuming that because the geometry shader specifices what type of primitive it handles it discards all others.
Ideally it would just pass-through other primitives that do not match the layout qualifer (layout(lines) in;)
After searching the internet it seems I should create different geometry shaders for the different types of primitives I want to use.
So for triangles I basically just want to pass-through and for points I want to do similar thickness stuff.
My question is: How do I tell Ogre to use the different geometry shaders (in a single Hlms)?
To get the one I have working I simply created a GeometryShader_gs.glsl file and it compiled and used it automatically. So I'm guessing there is something telling Ogre to look for that file. As for the other shader types this is done for each Hlms type, but I would prefer not adding a new Hlms just to be able to render other types or primitives, that seems overkill.
Edit: I suppose it could be done by having datablocks define what shader they need, but again that would mean specific datablocks only work for specific primitives, which doesn't seem like a relation that should be required. It would also mean I need to create many new datablocks. The best would be if it could just automatically switch geometry shader based on the type of primitive.
If there is a different/better solution let me know!