opengl - GLSL Shader to convert six textures to Equirectangular projection -


i want create equirectangular projection 6 quadratic textures, similar converting cubic projection image equirectangular image, separate faces textures instead of 1 texture in cubic projection.

i'd on graphics card performance reasons, , therefore want use glsl shader.

i've found shader converts cubic texture equirectangular one: link

step 1: copy 6 textures cube map texture. can binding textures fbos , using glblitframebuffer().

step 2: run following fragment shader. need vary coord attribute (-1,-1) (+1,+1) on quad.

#version 330 // x -1..+1, y -1..+1 in vec2 coord; out vec4 color; uniform samplercube texture;  void main() {     // convert (lat, lon) angle     vec2 = coord * vec2(3.14159265, 1.57079633);     // convert cartesian coordinates     vec2 c = cos(a), s = sin(a);     color = sampler(texture, vec3(vec2(s.x, c.x) * c.y, s.y)); } 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -