[osg-users] OSG-GLSL triangle adjacency

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Fri Jul 21 02:02:42 PDT 2017

Hi Nabil,

> Thank you Sebastian. So If i set the DrawArrays mode of the 
> PrimitiveSet, does it suffice?
> Otherwise, is it easy to implement? Sorry but i'm newby in OSG.
Can you elaborate on this?

Usually you need to set the program-parameter for output: 
GL_GEOMETRY_INPUT_TYPE and simply pass you geometry.

So when using triangles for instance, you need to pass 3 additional 
vertices per triangle (the neighboring ones). You can get the 
appropriate order from the openGL spec or various examples.
I'd start with a minimal example with a fixed vertex set to see what 
needs to be set in the state and program.

The osggeometryshader example might help here to get started.

> On 21 July 2017 at 09:36, Sebastian Messerschmidt 
> <sebastian.messerschmidt at gmx.de <mailto:sebastian.messerschmidt at gmx.de>> 
> wrote:
>     Hi Nabil,
>         Hello,
>         I'm using geometry shader with OSG to do some operations on mesh
>         using GPU.
>         When i use /triangles_adjacency/  in the input layout, my shader
>         crashes.
>         I tried with /layout(triangles) in/  and it's running well.
>         Is there any configuration in OSG that i should use, or a
>         pre-processing on the mesh to understand triangle adjacency?
>     You need to pre-process the mesh to get the adjacency information.
>     There is no facility in OSG that I know of, wich does this for you.
>     Cheers
>     Sebastian
>         Regards,
>         Nabil
>         _______________________________________________
>         osg-users mailing list
>         osg-users at lists.openscenegraph.org
>         <mailto:osg-users at lists.openscenegraph.org>
>         http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>         <http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>
> -- 
> Nabil Khalifa

More information about the osg-users mailing list