Jump to content

  • Log In with Google      Sign In   
  • Create Account

GL_TEXTURE_2D Array glGenerateMipmaps.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 BornToCode   Members   -  Reputation: 950

Like
0Likes
Like

Posted 04 November 2013 - 09:32 AM

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


Edited by BornToCode, 04 November 2013 - 09:34 AM.


Sponsor:

#2 BornToCode   Members   -  Reputation: 950

Like
0Likes
Like

Posted 05 November 2013 - 12:05 AM

i Solved it.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS