38 lines
605 B
Text
38 lines
605 B
Text
|
// vertex shader
|
||
|
#version 150
|
||
|
in vec2 in_Position;
|
||
|
in vec3 in_Color;
|
||
|
|
||
|
out vec3 ex_Color;
|
||
|
void main(void) {
|
||
|
gl_Position = vec4(in_Position.x, in_Position.y, 0.0, 1.0);
|
||
|
ex_Color = in_Color;
|
||
|
}
|
||
|
|
||
|
|
||
|
// geometry shader
|
||
|
#version 150
|
||
|
|
||
|
layout(triangles) in;
|
||
|
layout(triangle_strip, max_vertices = 3) out;
|
||
|
|
||
|
void main() {
|
||
|
for(int i = 0; i < gl_in.length(); i++) {
|
||
|
gl_Position = gl_in[i].gl_Position;
|
||
|
EmitVertex();
|
||
|
}
|
||
|
EndPrimitive();
|
||
|
}
|
||
|
|
||
|
|
||
|
// fragment shader
|
||
|
#version 150
|
||
|
precision highp float;
|
||
|
|
||
|
in vec3 ex_Color;
|
||
|
out vec4 gl_FragColor;
|
||
|
|
||
|
void main(void) {
|
||
|
gl_FragColor = vec4(ex_Color, 1.0);
|
||
|
}
|