View Full Version : Cube Maps flipped at origin
10-23-2002, 12:34 PM
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?
10-23-2002, 02:33 PM
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).
10-24-2002, 11:53 AM
I'm using the following Code ro enable reflection mapping:
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
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.
10-24-2002, 12:33 PM
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.
10-24-2002, 08:45 PM
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.
10-27-2002, 01:51 AM
You were right. I put the camera movement in the modelview matrix and now the problem is gone.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.