I try to use a dynamic created cube map for reflection lookup in the per pixel
shader. I read a lot of stuff in the Internet but I still have a Problem.
The reflection on a sphere always show the reflection looking from origin to Z+ direction, independent on the camera position and direction ??? see pictures.
I created the the cubemap using the following code from openglwiki
which seams to work.
openglwiki
before rendering the scene I render the 6 faces (+X-X+Y-Y+Z-Z) in WORLD SPACE.
here the lines in the vertex shader
m_normal = normalize(gl_NormalMatrix * gl_Normal);m_eyeVec = gl_ModelViewMatrix * gl_Vertex;...gl_Position = ftransform();
and fragment shader
uniform samplerCube environmentTex;...vec3 normal = normalize(m_normal);...vec3 refVec = normalize(reflect(m_eyeVec, normal));vec3 color = textureCube(environmentTex, refVec).rgb;