GL_TEXTURE_2D Array glGenerateMipmaps.

Started by
0 comments, last by BornToCode 10 years, 5 months ago

When i use GL_TEXTURE_2D Array with glGenerateMipmaps and call glTexImage3D to generate an set of 2d texture array with automatic mipmaps. It never generate any of the mipmaps for the set of 2d textures. I did a test where i change the depth value of glTexImage3D then it generate the mipmap based on the depth which makes no sense. Have anyone ever run into this problem before. I though that each individual mipmaps could generate their own set of mipmaps and that it is not based of the depth.

This is how i am setting it up.

glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_MIN_FILTER,GL_NEAREST_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
int bufferSize = w*h*numChannels*sizeofEachComponent*d;
unsigned char* arrayData = new unsigned char[bufferSize];
memset(arrayData,0,bufferSize);
glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
for(GLuint depthIndex = 0; depthIndex < pDesc->ArraySize; depthIndex++)
{
const void* currentResourceData = (pInitialData) ? pInitialData[depthIndex].pSysMem:NULL;
if(currentResourceData)
{
int oneLayer = w*h*numChannels*sizeofEachComponent;
unsigned char* memoryLocation = &arrayData[oneLayer*depthIndex];
memcpy(memoryLocation,currentResourceData,oneLayer);
}
}
glTexImage3D(GL_TEXTURE_2D_ARRAY,0,internalFormat,w,h,d,0,sizeFormat,typeInternalFormat,arrayData);

So when i test the code in CodeXL it tells me there is no mipmpas generated for the glTexdImage3D, but when i set the depth to a different value than 1 then it generate mipmaps. It seems to me that for 3D textues mipmaps are generated based on depth which makes sense, but for Texture2D_ARRAY it does not.

Thanks,

Jerome

Advertisement

i Solved it.

This topic is closed to new replies.

Advertisement