#version 300 es //http://www.shaderific.com/blog/2014/3/13/tutorial-how-to-update-a-shader-for-opengl-es-30 in vec3 position; in vec3 normal; in vec2 texCoord; uniform mat4 PVM; uniform mat4 Model; uniform mat4 Proj; uniform mat4 View; uniform mat4 normalMatrix; out vec3 norm; out vec3 fragPos; out vec2 uv; out vec3 fogPosition; void main(){ /* Out data */ /* Normal */ norm = normalize((normalMatrix * vec4(normal, 0.0f)).xyz); /* Fragment (vertex) position in World coordinates */ fragPos = (Model * vec4(position, 1.0f)).xyz; /* Texturing coordinates */ uv = texCoord; //fogPosition = (View * vec4(position, 1.0f)).xyz; /* Vertex position in ClipSpace * After VS the Clip Spaces coordinates are divided by W and transformed into NDC space (with perspective) */ gl_Position = PVM * vec4(position, 1.0f); }