Cube Maps flipped at origin

I’m trying to use Cube Maps in one of my programs, but I have a problem.

A object before the origin shows a diffrent side of the cube map than a object behind the origin, though both face in the same direction.
That means if I rotate a sphere around the origin it shows one time the part of the cube map behind me and one time the part in front of me.

Any ideas why?

I don’t think your texgen mode is correct. It should be in REFLECTION_MAP or NORMAL_MAP mode.

Note that you may have to take into account what the rotation of the camera relative to the object relative to the world is, too, for it all to work right. If this is your problem, try making the object spin around slowly and see if the environment map spins with it – it shouldn’t (as the camera isn’t spinning).

I’m using the following Code ro enable reflection mapping:



When I spin the Objectaround it’s own axis the reflection stays constant. But if the object has a certain distance to the origin and I spin it around the origin it reflects opposite parts of the cubemap, depending on whether it is before or behind the orign.

Which origin are you talking about? The origin is always in the camera. If you adjust the origin using the projection matrix, all kinds of bad things may happen.

I’m talking about the point (0,0,0) in Worldspace not in cameraspace.
Can’t the projection Matrix be used, to move the origin of the scene?

You screw up all kinds of things if you play with the projectionmatrix…
to simulate a camera that moves around the object, just put the inverse of the camera rotation into the texturematrix for the textureunit that contains the cubemap.

You were right. I put the camera movement in the modelview matrix and now the problem is gone.