-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstar.vert
More file actions
33 lines (29 loc) · 844 Bytes
/
star.vert
File metadata and controls
33 lines (29 loc) · 844 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
#version 130
#extension GL_ARB_draw_instanced: enable
#extension GL_ARB_explicit_attrib_location: enable
// Star quad
const float star_size = 0.5; // equals to graphics.h::update_view()::star_size
const vec2 star[] = vec2[](
vec2(-star_size, -star_size),
vec2(-star_size, star_size),
vec2( star_size, -star_size),
vec2( star_size, star_size)
);
// Texture quad
const vec2 texture_coords[] = vec2[](
vec2(0, 0),
vec2(0, 1),
vec2(1, 0),
vec2(1, 1)
);
uniform mat4 projection;
layout(location=1) in vec2 star_position;
layout(location=2) in vec3 star_color;
out vec2 texture_pos;
out vec3 f_star_color;
void main()
{
gl_Position = projection * vec4(star_position + star[gl_VertexID], 0, 1);
texture_pos = texture_coords[gl_VertexID];
f_star_color = star_color;
}