Add shader programs to be tracked

This commit is contained in:
jgk
2021-02-15 14:10:41 +01:00
parent 9f4497fb39
commit e8b4f8791b
8 changed files with 136 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
#version 430 core
in vec4 vColor;
out vec4 fColor;
void main()
{
fColor = vColor;
}
+9
View File
@@ -0,0 +1,9 @@
#version 430 core
layout (location = 0) in vec3 position;
layout (location = 1) in vec4 color;
out vec4 vColor;
void main()
{
gl_Position = vec4(position,1);
vColor = color;
}
+15
View File
@@ -0,0 +1,15 @@
#version 430 core
out vec4 FragColor;
in vec4 gColor;
in vec2 gTex;
uniform sampler2D aTexture;
void main()
{
FragColor = texture(aTexture, gTex) * gColor;
// FragColor = texture(aTexture, vTexCoord);
// FragColor = gColor;
// FragColor = vec4 (1,1,1,1);
}
+36
View File
@@ -0,0 +1,36 @@
#version 430 core
layout (points) in;
layout (triangle_strip, max_vertices = 4) out;
in vec4 vColor [];
in vec2 vTexCoord [];
out vec4 gColor;
out vec2 gTex;
void main()
{
vec3 cenPos = gl_in[0].gl_Position.xyz;
float size = vTexCoord[0].y;
//float size = 0.05;
gColor = vColor[0];
float texPos = vTexCoord[0].x;
gl_Position = vec4 (cenPos.x - size*0.5, cenPos.y - size, cenPos.z , 1);
//gl_Position = vec4 (0, 0 , 5 , 1);
gTex = vec2 (texPos*0.0078125, 1);
EmitVertex();
gl_Position = vec4 (cenPos.x - size*0.5, cenPos.y + size, cenPos.z , 1);
//gl_Position = vec4 (0, 0.5 , 5 , 1);
gTex = vec2 (texPos*0.0078125, 0);
EmitVertex();
gl_Position = vec4 (cenPos.x + size*0.5, cenPos.y - size, cenPos.z , 1);
//gl_Position = vec4 (0.5, 0.5 , -5 , 1);
gTex = vec2 ((texPos+1)*0.0078125, 1);
EmitVertex();
gl_Position = vec4 (cenPos.x + size*0.5, cenPos.y + size, cenPos.z , 1);
gTex = vec2 ((texPos+1)*0.0078125, 0);
//gl_Position = vec4 (0.5, 0 , -5 , 1);
EmitVertex();
EndPrimitive();
}
+15
View File
@@ -0,0 +1,15 @@
#version 430 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec4 aColor;
layout (location = 2) in vec2 aTexCoord;
out vec4 vColor;
out vec2 vTexCoord;
void main()
{
gl_Position = vec4(aPos, 1.0);
vColor = aColor;
vTexCoord = aTexCoord;
}
+12
View File
@@ -0,0 +1,12 @@
#version 430 core
in vec4 gColor;
in vec2 cenPosTrans;
in float gRad;
out vec4 fColor;
void main()
{
vec2 pos = gl_FragCoord.xy;
float dist = max(0 , 1 - 2 * distance(pos,cenPosTrans) / (gRad));
fColor = vec4( gColor.xyz , pow(gColor.z*dist,2) );
}
+30
View File
@@ -0,0 +1,30 @@
#version 430 core
layout (points) in;
layout (triangle_strip, max_vertices = 4) out;
in vec4 vColor [];
in float vRad [];
uniform vec2 winSize;
out vec4 gColor;
out float gRad;
out vec2 cenPosTrans;
void main()
{
vec3 cenPos = gl_in[0].gl_Position.xyz;
vec2 cenPosa = cenPos.xy + vec2 (1,1);
cenPosTrans = vec2 (cenPosa * winSize * 0.5);
gColor = vColor[0];
gRad = vRad[0];
gl_Position = vec4 (cenPos.x + gRad/winSize.x, cenPos.y + gRad/winSize.y, cenPos.z , 1);
EmitVertex();
gl_Position = vec4 (cenPos.x - gRad/winSize.x, cenPos.y + gRad/winSize.y, cenPos.z , 1);
EmitVertex();
gl_Position = vec4 (cenPos.x + gRad/winSize.x, cenPos.y - gRad/winSize.y, cenPos.z , 1);
EmitVertex();
gl_Position = vec4 (cenPos.x - gRad/winSize.x, cenPos.y - gRad/winSize.y, cenPos.z , 1);
EmitVertex();
EndPrimitive();
}
+12
View File
@@ -0,0 +1,12 @@
#version 430 core
layout (location = 0) in vec3 position;
layout (location = 1) in vec4 color;
layout (location = 2) in float rad;
out vec4 vColor;
out float vRad;
void main()
{
gl_Position = vec4(position,1);
vColor = color;
vRad = rad;
}