skybox.vs (554B)
1 #version 330 2 3 // Input vertex attributes 4 in vec3 vertexPosition; 5 6 // Input uniform values 7 uniform mat4 matProjection; 8 uniform mat4 matView; 9 10 // Output vertex attributes (to fragment shader) 11 out vec3 fragPosition; 12 13 void main() 14 { 15 // Calculate fragment position based on model transformations 16 fragPosition = vertexPosition; 17 18 // Remove translation from the view matrix 19 mat4 rotView = mat4(mat3(matView)); 20 vec4 clipPos = matProjection*rotView*vec4(vertexPosition, 1.0); 21 22 // Calculate final vertex position 23 gl_Position = clipPos; 24 }