-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgeometry.glsl
More file actions
39 lines (28 loc) · 827 Bytes
/
geometry.glsl
File metadata and controls
39 lines (28 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#version 430 core
layout(points) in;
layout(triangle_strip, max_vertices = 4) out;
uniform mat4 projectionMatrix;
in vec4 vSize[];
in vec4 vColor[];
out vec2 gTexCoord;
out vec4 gColor;
void main(void)
{
const vec4 position = gl_in[0].gl_Position;
const float width = vSize[0].x;
const float height = vSize[0].y;
gColor = vColor[0];
gl_Position = projectionMatrix * (position + vec4(-width, -height, 0, 0));
gTexCoord = vec2(0, 0);
EmitVertex();
gl_Position = projectionMatrix * (position + vec4(-width, height, 0, 0));
gTexCoord = vec2(0, 1);
EmitVertex();
gl_Position = projectionMatrix * (position + vec4(width, -height, 0, 0));
gTexCoord = vec2(1, 0);
EmitVertex();
gl_Position = projectionMatrix * (position + vec4(width, height, 0, 0));
gTexCoord = vec2(1, 1);
EmitVertex();
EndPrimitive();
}