Hey,
I want to load a cube texture for cubic environment mapping. And I load 6 pictures in for 6 faces under same texture ID (here is 1) which is called by glBindTexture(). And I think it has some problem.
And this is my code:
glBindTexture (GL_TEXTURE_CUBE_MAP , 1);
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
glTexParameteri (GL_TEXTURE_CUBE_MAP , GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri (GL_TEXTURE_CUBE_MAP , GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri (GL_TEXTURE_CUBE_MAP , GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_CUBE_MAP , GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, texFormat, imageWidth, imageHeight, 0, texFormat, GL_UNSIGNED_BYTE, imageData1);
glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, texFormat, imageWidth, imageHeight, 0, texFormat, GL_UNSIGNED_BYTE, imageData2);
glTexImage2D (GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, texFormat, imageWidth, imageHeight, 0, texFormat, GL_UNSIGNED_BYTE, imageData3);
glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, texFormat, imageWidth, imageHeight, 0, texFormat, GL_UNSIGNED_BYTE, imageData4);
glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, texFormat, imageWidth, imageHeight, 0, texFormat, GL_UNSIGNED_BYTE, imageData5);
glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, texFormat, imageWidth, imageHeight, 0, texFormat, GL_UNSIGNED_BYTE, imageData6);
The last line simply repeated 6 times for 6 faces which are loaded in imageData. I think it is fine for imageData1, imageData2…
Any ideas? Maybe this guy is correct but some parts else in my code is wrong… It may possible.
Thank you.