New answers tagged

3

Instead of atan(sf.y/sf.x), use atan(sf.y,sf.x). This works because it takes the sign into consideration. Dividing the two numbers loses the sign bit data, so which quadrant you are in is unknown. You can add fragColor=vec4(pr,f,0.0,1.0); to see what is going on. Also, if you want to fix your aspect ratio (the image stretching) add sf.y *= ...


0

For people who come here from Google (like me), the shader version is: fract (tex_coord.st) this will loop coordinates in range 0.0 - 1.0


0

You would have to render your scene into a cube map, then render a quad. The texture coordinates would then translate directly to longitude/latitude you can use to calculate the vector to use for sampling the cube map. For equirectangular projection: lon = u*2*pi lat = (v*2-1)*2*pi x = cos(lon)*cos(lat) y = sin(lon)*cos(lat) z = sin(lat) Where u/v are ...


3

The problem was there gl_FragColor = (1.0, 0 , 0 ,1.0);//vec4(texVal.rgb, texVal.a)*(1.0, 0 , 0 ,1.0); it miss the vec4 name gl_FragColor = vec4(1.0, 0 , 0 ,1.0);//vec4(texVal.rgb, texVal.a)*vec4(1.0, 0 , 0 ,1.0);



Top 50 recent answers are included