I'm writing a geometry shader to create lines of a given thickness.
Currently I have a solution which lets me set thickness and it works fine, example:
As you can see there are gaps between line segments due to how the expansion is done (normal to the line).
I have found plenty of examples on how to remedy this, but it requires that the shader knows about adjacent lines.
This seems to be a fairly common concept, as it is possible to "request" lines_adjacency in the geometry shader.
If I have understood correctly this should give me 4 vertices (3 line segments) instead of the usual 2 (single line segment).
The indexes are now: 0 - prev segment start, 1 - prev end/current start, 2 - current end/next start, 3 - next end.
I have tried to set the input layout: layout(lines_adjacency) and adjusted my indexes accordingly, but the line is not rendered.
To clarify: I am trying to switch from lines to lines_adjacency and do nothing new with the information, just render as before using the new indexes.
It does not complain about the indexing (as it would if I try to access an index above 1 for lines without adjacency).
A quick search through the Ogre source showed that the render system should detect if adjacency is needed or not (OgreGL3PlusRenderSystem.cpp line 2539):
Code: Select all
// Use adjacency if there is a geometry program and it request adjacency info. bool useAdjacency = (mGeometryProgramBound && mPso->geometryShader && mPso->geometryShader->isAdjacencyInfoRequired());
There is a reference to adjacency in the manual which should be set using material scripts, I am not using material scripts (since switching to 2.1) at all, are they required?
I would add more information if I knew what else to try, will supply any information you need just ask!