//Two useful shader snippets //convert V from cartesian coordinates to polar coordinates (stored in UV) float yaw = 0.0; yaw = atan2(V.x,V.z) / 6.28318531 - 0.25; float pitch = asin(V.y) / 1.57079633; uv = vec2(yaw,abs(pitch)); vec3 cielo = texture2DLod(reflection, uv,0.0); //How to project vertex to screen in normalized coordinates (useful for reflections) //in the vertex shader send this in a varying screen_pos = gl_ModelViewProjectionMatrix * gl_Vertex; //and in the pixel shader screen_pos.xy = (screen_pos.xy / screen_pos.w) * 0.5 + vec2(0.5,0.5);