CGII/framework/shader/cgv_gl/glsl/normal.glgs
2018-05-17 16:01:02 +02:00

21 lines
462 B
Text

#version 150 compatibility
#extension GL_EXT_geometry_shader4 : enable
layout(points) in;
layout(line_strip, max_vertices = 2) out;
uniform float normal_length;
in vec3 normal_gs[];
in vec4 color_gs[];
out vec4 color;
void main()
{
color = color_gs[0];
gl_Position = gl_ModelViewProjectionMatrix * gl_PositionIn[0];
EmitVertex();
gl_Position = gl_ModelViewProjectionMatrix * (gl_PositionIn[0] + normal_length * vec4(normal_gs[0],0.0));
EmitVertex();
}