Hi,

alternatively you can setup a geometry shader to run a second pass [1]:

layout(triangles) in;
layout(line_strip, max_vertices=6) out;

// (projection * view * model) matrix
uniform mat4 proj_view_model;

// length of the normal (object space)
uniform float normal_length;

in vec3 normal;

out NDData {
    vec3 normal;
} nd_out;

void main() {
   for (int i = 0; i < 3; i++) {
       gl_Position = gl_in[i].gl_Position;
       nd_out.normal = normal;
       EmitVertex();
       gl_Position = gl_in[i].gl_Position +
           proj_view_model * vec4(normal * normal_length, 0.f);
       nd_out.normal = normal;
       EmitVertex();
       EndPrimitive();
   }
}

[1] from: https://wiki.delphigl.com/index.php/shader_normal_debug_330

Cheers
Sebastian

Hi everyone,

I have to debug a normal issue with my model, so I made a code to display them 
(transform normals in a bunch of gl_lines and create a resulted geometry).

I share the gist in case it may help:
https://gist.github.com/fulezi/95a9ac319fd1cbeca1b18a4cde3986dc



Have a nice day,
Florian

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72504#72504





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to