first commit for versioning
This commit is contained in:
8
shaders/tShader01.frag
Normal file
8
shaders/tShader01.frag
Normal file
@@ -0,0 +1,8 @@
|
||||
// First fragment shader
|
||||
|
||||
#version 460
|
||||
out vec4 frag_colour;
|
||||
|
||||
void main() {
|
||||
frag_colour = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
8
shaders/tShader01.vert
Normal file
8
shaders/tShader01.vert
Normal file
@@ -0,0 +1,8 @@
|
||||
// First vertex shader
|
||||
|
||||
in vec3 vp;
|
||||
|
||||
|
||||
void main () {
|
||||
gl_Position = vec4(vp.x + 0.4, vp.y + 0.2, vp.z, 1.0);
|
||||
}
|
||||
8
shaders/tShader02.frag
Normal file
8
shaders/tShader02.frag
Normal file
@@ -0,0 +1,8 @@
|
||||
// First fragment shader
|
||||
|
||||
#version 460
|
||||
out vec4 frag_colour;
|
||||
|
||||
void main() {
|
||||
frag_colour = vec4(0.3, 0.6, 0.6, 1.0);
|
||||
}
|
||||
8
shaders/tShader02.vert
Normal file
8
shaders/tShader02.vert
Normal file
@@ -0,0 +1,8 @@
|
||||
// First vertex shader
|
||||
|
||||
in vec3 vp;
|
||||
|
||||
|
||||
void main () {
|
||||
gl_Position = vec4(vp.x, vp.y - 0.2, vp.z, 1.0);
|
||||
}
|
||||
8
shaders/tShader03.frag
Normal file
8
shaders/tShader03.frag
Normal file
@@ -0,0 +1,8 @@
|
||||
#version 460
|
||||
|
||||
in vec3 colour;
|
||||
out vec4 frag_colour;
|
||||
|
||||
void main() {
|
||||
frag_colour = vec4(1.0 - colour.r, 1.0 - colour.g, 1.0 - colour.b, 1.0);
|
||||
}
|
||||
18
shaders/tShader03.vert
Normal file
18
shaders/tShader03.vert
Normal file
@@ -0,0 +1,18 @@
|
||||
#version 460
|
||||
|
||||
layout(location = 0) in vec3 vertex_position;
|
||||
layout(location = 1) in vec3 vertex_colour;
|
||||
|
||||
uniform mat4 matrix;
|
||||
uniform mat4 view;
|
||||
uniform mat4 proj;
|
||||
|
||||
out vec3 colour;
|
||||
|
||||
void main() {
|
||||
colour = vertex_colour;
|
||||
// multiplication in column major order
|
||||
// currently proj * view * matrix * vec4(vertex_position, 1.0) does not work! projection matrix is wrong?
|
||||
// need to reread the chapter
|
||||
gl_Position = proj * view * matrix * vec4(vertex_position, 1.0);
|
||||
}
|
||||
10
shaders/test.frag
Normal file
10
shaders/test.frag
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 410
|
||||
|
||||
// uniform key-word -- we are sending in a variable to the shader programme from the CPU
|
||||
uniform vec4 inputColour;
|
||||
const vec4 testColour = vec4(0.5f, 1.0f, 1.0f, 1.0f);
|
||||
out vec4 fragColour;
|
||||
|
||||
void main() {
|
||||
fragColour = inputColour;
|
||||
}
|
||||
15
shaders/wmo.frag
Normal file
15
shaders/wmo.frag
Normal file
@@ -0,0 +1,15 @@
|
||||
#version 400 core
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec2 TexCoord;
|
||||
uniform sampler2D texSampler;
|
||||
|
||||
void main() {
|
||||
// sample the texture
|
||||
vec4 texColor = texture(texSampler, TexCoord);
|
||||
|
||||
if (texColor.a < 0.1) discard;
|
||||
|
||||
//FragColor = vec4(0.6, 0.0, 1.0, 1.0);
|
||||
FragColor = texColor;
|
||||
}
|
||||
15
shaders/wmo.vert
Normal file
15
shaders/wmo.vert
Normal file
@@ -0,0 +1,15 @@
|
||||
#version 400 core
|
||||
layout(location = 0) in vec3 vertex_position; // position
|
||||
layout(location = 1) in vec3 vertex_normal; // colour of each vertex point
|
||||
layout(location = 2) in vec2 vertex_tex;
|
||||
|
||||
out vec2 TexCoord;
|
||||
|
||||
uniform mat4 matrix; // must match "matrix" in C code
|
||||
uniform mat4 view; // must match "view" in C code
|
||||
uniform mat4 proj; // must match "proj" in C code
|
||||
|
||||
void main() {
|
||||
gl_Position = proj * view * matrix * vec4(vertex_position, 1.0);
|
||||
TexCoord = vertex_tex;
|
||||
}
|
||||
Reference in New Issue
Block a user