Commit 0a9c2b6b authored by Georg Schaefer's avatar Georg Schaefer
Browse files

replace gl_TexCoord with custom varying because its deprecated

parent 0d6c3a56
#version 330
in vec2 texcoord_;
in vec3 color_;
out vec4 frag_color;
......@@ -7,7 +8,7 @@ out vec4 frag_color;
uniform sampler2D albedo_texture;
void main() {
vec4 color = texture(albedo_texture, gl_TexCoord[0].st);
vec4 color = texture(albedo_texture, texcoord_);
if (color.a <= 0.f) {
discard;
}
......
......@@ -5,6 +5,7 @@ layout(triangle_strip, max_vertices = 6) out;
in float _size_[];
in vec3 _color_[];
out vec2 texcoord_;
out vec3 color_;
uniform mat4 projection;
......@@ -12,42 +13,42 @@ uniform mat4 projection;
void main() {
float half_size = _size_[0] * 0.5f;
gl_TexCoord[0].st = vec2(0.f);
texcoord_ = vec2(0.f);
gl_Position = gl_in[0].gl_Position;
gl_Position.xy += vec2(-half_size);
gl_Position = projection * gl_Position;
color_ = _color_[0];
EmitVertex();
gl_TexCoord[0].st = vec2(1.f, 0.f);
texcoord_ = vec2(1.f, 0.f);
gl_Position = gl_in[0].gl_Position;
gl_Position.xy += vec2(half_size, -half_size);
gl_Position = projection * gl_Position;
color_ = _color_[0];
EmitVertex();
gl_TexCoord[0].st = vec2(1.f, 1.f);
texcoord_ = vec2(1.f, 1.f);
gl_Position = gl_in[0].gl_Position;
gl_Position.xy += vec2(half_size);
gl_Position = projection * gl_Position;
color_ = _color_[0];
EmitVertex();
gl_TexCoord[0].st = vec2(1.f, 1.f);
texcoord_ = vec2(1.f, 1.f);
gl_Position = gl_in[0].gl_Position;
gl_Position.xy += vec2(half_size);
gl_Position = projection * gl_Position;
color_ = _color_[0];
EmitVertex();
gl_TexCoord[0].st = vec2(0.f);
texcoord_ = vec2(0.f);
gl_Position = gl_in[0].gl_Position;
gl_Position.xy += vec2(-half_size);
gl_Position = projection * gl_Position;
color_ = _color_[0];
EmitVertex();
gl_TexCoord[0].st = vec2(0.f, 1.f);
texcoord_ = vec2(0.f, 1.f);
gl_Position = gl_in[0].gl_Position;
gl_Position.xy += vec2(-half_size, half_size);
gl_Position = projection * gl_Position;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment