Hi all, I am trying out some dynamic cube mapping and I’ve come to a complete halt.
I don’t know how to descirbe it really, and I don’t have a webby site to put a screenshot on, but I’ll try…
If i look straight on to the sphere that is mapped, I can make out all the faces (xpos,zneg etc) and It looks like it is using the same texture for them all (so It kinda looks like a soccer ball with the indents). But when I move around it the image will change - So at any one time it is reflecting the right image, but none of the other faces are right.
Gah, just gone and confused myself there, I may have to find somewhere to put a screenshot :P.
GLint base = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB;
// Now set up a new perspective
// the fov must be 90
float fieldofview, nearclip, farclip;
gluPerspective(90, 1.0, nearclip, farclip);
for (int i = 0; i < 6; ++i)
//Clear the depth buffer.
//Reset modelview matrix. glLoadIdentity(); glTranslatef(pos.x,pos.y,pos.z);
glRotatef(CubeRots[i], CubeRots[i], CubeRots[i], CubeRots[i]);
// Now render everything (world)->Update(); glDisable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_CUBE_MAP_ARB); glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, cubemap); glCopyTexImage2D(base + i, 0, GL_RGB8, 0, 0, texDepth, texDepth,0); glDisable(GL_TEXTURE_CUBE_MAP_ARB);
// Reset THe window
Here are my texgens:
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
I know it sounds confusing, but I was just wondering if anyone has had any odd occurances with CM and how they managed to fix it.
[This message has been edited by robert (edited 01-13-2003).]