Wireframe rendering

posted Nov 25, 2012, 7:06 AM by Nico Kruithof   [ updated Nov 25, 2012, 7:06 AM ]
The following geometry shaders renders geometry in wireframe.

#version 330
#extension GL_ARB_geometry_shader4 : enable

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

///////////////////////
void main()
{
  gl_Position = gl_PositionIn[0];
  EmitVertex();
  gl_Position = gl_PositionIn[1];
  EmitVertex();
  gl_Position = gl_PositionIn[2];
  EmitVertex();
  gl_Position = gl_PositionIn[0];
  EmitVertex();
}

Comments