ported the University CGI demo from WINDOWS + GLUT + GLEW + GLU + OpenGL 4 to LINUX WAYLAND + EGL + GLES 2 with minimal cuts
This commit is contained in:
41
resources/vertexShader_gourard.glsl
Executable file
41
resources/vertexShader_gourard.glsl
Executable file
@@ -0,0 +1,41 @@
|
||||
#version 300 es
|
||||
|
||||
/*this will affect all the float guys (float, vecN, matN )*/
|
||||
precision mediump float;
|
||||
|
||||
layout (location = 0) in vec3 vertPos; // Attributo Posizione
|
||||
layout (location = 1) in vec2 coord_uv; // Attributo texture
|
||||
layout (location = 2) in vec3 vertNor;
|
||||
layout (location = 3) in vec3 vertTan;
|
||||
layout (location = 4) in vec3 vertBitan;
|
||||
|
||||
uniform mat4 Model;
|
||||
uniform mat4 ModelRot;
|
||||
uniform mat4 Projection;
|
||||
uniform mat4 View;
|
||||
|
||||
out vec3 fragPos;
|
||||
out vec2 frag_uv;
|
||||
out vec3 fragNormal;
|
||||
out vec3 fragBaryc;
|
||||
|
||||
out vec3 T;
|
||||
out vec3 B;
|
||||
out vec3 N;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_uv = coord_uv;
|
||||
vec3 normal = normalize(vertNor);
|
||||
|
||||
mat3 mv = mat3(View * Model);
|
||||
T = normalize(mv * vertTan);
|
||||
B = normalize(mv * vertBitan);
|
||||
N = normalize(mv * vertNor);
|
||||
|
||||
fragNormal = mat3(ModelRot) * vec3(normal);
|
||||
fragPos=(Model*vec4(vertPos,1)).xyz;
|
||||
gl_Position=Projection*View*Model*vec4(vertPos,1);
|
||||
fragBaryc = vec3(gl_VertexID % 3 == 0, gl_VertexID % 3 == 1, gl_VertexID % 3 == 2);
|
||||
}
|
||||
Reference in New Issue
Block a user