used gl_Position = orthoProjectionMatrix*vertex but not knowing how to do that, I just used the canvas. Don't know if that makes a difference.
This project doesn't run outside of FL STudio - but here is the glsl .
If anyone can help, I'd appreciate it.
Vertex Shader:
Code: Select all
void main()
{
vec4 vertex = gl_Vertex;
vertex.xy *= 2.0;
gl_Position = vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}
Code: Select all
uniform sampler2D tex1;
uniform float scale,px,py,Alpha;
uniform vec3 rot;
uniform float width,height;
#define PI 3.141592653589793
mat3 getrot(vec3 r)
{
float cx = cos(radians(r.x));
float sx = sin(radians(r.x));
float cy = cos(radians(r.y));
float sy = sin(radians(r.y));
float cz = cos(radians(r.z));
float sz = sin(radians(r.z));
float m1,m2,m3,m4,m5,m6,m7,m8,m9;
m1=cy*cz;
m2=cx*sz+sx*sy*cz;
m3=sx*sz-cx*sy*cz;
m4=-cy*sz;
m5=cx*cz-sx*sy*sz;
m6=sx*cz+cx*sy*sz;
m7=sy;
m8=-sx*cy;
m9=cx*cy;
return mat3(m1,m2,m3,m4,m5,m6,m7,m8,m9);
}
void main(){
mat3 t=getrot(rot);
vec2 rads = vec2(PI*2.0 , PI);
vec2 offset=vec2(px,py);
vec2 pnt = (gl_TexCoord[0] - .5-offset).xy*vec2(scale, scale*height/width);
// Project to Sphere
float x2y2 = pnt.x * pnt.x + pnt.y * pnt.y;
vec3 sphere_pnt = vec3(2. * pnt, x2y2 - 1.0) / (x2y2 + 1.0);
sphere_pnt *= t;
// Convert to Spherical Coordinates
float r = length(sphere_pnt);
float lon = atan(sphere_pnt.y, sphere_pnt.x);
float lat = acos(sphere_pnt.z / r);
gl_FragColor = texture2D(tex1, vec2(lon, lat) / rads);
gl_FragColor *=Alpha;
}