Environment mapping with moving camera

Hi,
I’ve got environment mapping (GL_SPHERE_MAP) working on objects where the camera is fixed at its default position.

When I try to move the camera with gluLookAt, however, the environment map appears as a constant texture (because the texture coordinates are generated relative to the origin in eye coordinates?). Is there an elegant way to resolve this?

Cheers,

Steven Capper

A spheremap is a texture unique for one single position and direction. As long as the camera stays at this position, everything will be fine, as you said. But as soon as you move the camera, either position or direction (or both ), the spheremap needs to be rebuilt. No way around this, sorry.

If you can, use a cube texture instead. These cubetextures usually generates far better reflections, and can very easily be updated when you move the camera.