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.
glViewport(0,0,texDepth,texDepth);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();GLint base = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB;
// Now set up a new perspective
// the fov must be 90
float fieldofview, nearclip, farclip;
getAspectRatio(fieldofview,nearclip,farclip);gluPerspective(90, 1.0, nearclip, farclip);
glMatrixMode(GL_MODELVIEW);
for (int i = 0; i < 6; ++i)
{
//Clear the depth buffer.
glClear(GL_DEPTH_BUFFER_BIT);//Reset modelview matrix. glLoadIdentity(); glTranslatef(pos.x,pos.y,pos.z);
//Rotate
glRotatef(CubeRots[i][0], CubeRots[i][1], CubeRots[i][2], CubeRots[i][3]);// 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
setViewportPersp();
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).]