xerzi
06-05-2011, 11:50 PM
I'm trying to get a cubemap to work with only some luck, I can visible see parts of the image on the cube map but when I rotate it, it starts to distort and becomes a mess. There seems to be a lot of threads pertaining to cubemaps but I haven't seem to found any sort of solution. Any help or link to good examples would be appreciated.
vertex:
uniform vec3 eyePosition;
varying vec3 reflection;
void main(void)
{
gl_Position = ftransform();
vec3 normal = normalize(gl_NormalMatrix * gl_Normal);
vec3 direction = normalize(eyePosition.xyz - gl_Position.xyz);
reflection = normalize(reflect(direction, normal));
}
frag:
varying vec3 reflection;
void main(void)
{
gl_FragColor = textureCube(texCube, reflection);
}
vertex:
uniform vec3 eyePosition;
varying vec3 reflection;
void main(void)
{
gl_Position = ftransform();
vec3 normal = normalize(gl_NormalMatrix * gl_Normal);
vec3 direction = normalize(eyePosition.xyz - gl_Position.xyz);
reflection = normalize(reflect(direction, normal));
}
frag:
varying vec3 reflection;
void main(void)
{
gl_FragColor = textureCube(texCube, reflection);
}