Howdy all, I’ve been having trouble with my dynamic cube map creation. When i render the 6 sides of the cube, the images come out as though the camera were shifted about 1000 units closer in that direction, So that the cube map images don’t align when placed back on a cube. Almost like it’s only rendering 256x256 of a 512x512 view.
I’ve tried shifting the camera, resizing my scene, and even playing around with the projection matricies. does anyone have any suggestions? And for reference, here is my code.
GVector3 dirs[6] = {GVector3(-1.0f,0.f,0.0f),GVector3(1.f,0.0f,0.0f),
GVector3(0.0f,1.f,0.01f),GVector3(0.0f,-1.f,0.01f),
GVector3(0.0f,0.0f,1.f),GVector3(0.0f,0.0f,-1.f)};bool RenderCubeMap(int texID, float x, float y, float z)
{
int size=256;
glViewport(0,0,size,size);gluPerspective(90.f,1.f,10.f,20000.f);
for(int i=0;i<6;i++)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ;
glLoadIdentity();//glTranslatef(x,y,z); gluLookAt(x , y, z, dirs[i].x,dirs[i].y,dirs[i].z, 0.0,-1.0, 0.0); RenderWorld(); glEnable(GL_TEXTURE_CUBE_MAP_ARB); glBindTexture(GL_TEXTURE_CUBE_MAP_EXT, texID); glTexParameterf(GL_TEXTURE_CUBE_MAP_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER_ARB); glTexParameterf(GL_TEXTURE_CUBE_MAP_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER_ARB); glTexParameterf(GL_TEXTURE_CUBE_MAP_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_CUBE_MAP_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glCopyTexImage2D(texs[i], 0, GL_RGB, 0, 0, size,size, 0);
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
}
ReSizeGLScene(800,600);
return true;
}
[This message has been edited by duhroach (edited 05-15-2003).]