A WIP 3D game engine in C++ using OpenGL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
587 B

#version 330 core
layout (triangles) in;
layout (line_strip, max_vertices = 6) out;
in vec3 Normal[];
in vec3 FragPos[];
const float MAGNITUDE = 0.4;
uniform mat4 projection;
void GenerateLine(int index)
{
gl_Position = projection * FragPos[index];
EmitVertex();
gl_Position = projection * (FragPos[index] +
(Normal[index], 0.0) * MAGNITUDE);
EmitVertex();
EndPrimitive();
}
void main()
{
GenerateLine(0); // first vertex normal
GenerateLine(1); // second vertex normal
GenerateLine(2); // third vertex normal
}