[This question](https://stackoverflow.com/questions/59907996/shader-that-transforms-a-mercator-projection-to-equirectangular) and its answer, actually answer my question. I had to read its answer carefully and find my mistake. Now my fragment shader look like this: const GLchar* fragmentSource = R"glsl( #version 330 core in vec2 TexCoord; uniform sampler2D ourTexture; #define PI 3.141592653589793238462f #define TWO_PI 6.283185307179586476924f #define PI4 0.7853981633974483096155f void main(){ float lat = (TexCoord.y - 0.5f) * PI; if(lat >= -1.48442222974871 && lat <= 1.48442222974871){ float y = log(tan(PI4 + (lat / 2.0))); y = (y + PI) / TWO_PI; gl_FragColor = texture(ourTexture, vec2(TexCoord.x, y)); return; } gl_FragColor = vec4(1, 1, 1, 0); } )glsl"; And it's works perfectly.