CGII/framework/shader/cgv_gl/glsl/normal.glgs

22 lines
462 B
Text
Raw Normal View History

2018-05-17 14:01:02 +00:00
#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();
}