private void createPhotonMapTextures(){
  IntBuffer textures=BufferUtils.createIntBuffer(photonMapTextures.length);
  glGenTextures(textures);
  for (int i=0; i < photonMapTextures.length; i++) {
    TextureInfo info=new TextureInfo();
    info.openGlHandle=textures.get(i);
    Vector3f min=boxes[2 * i + 0];
    Vector3f max=boxes[2 * i + 1];
    float maxExtent=Math.max(Math.max(max.x - min.x,max.y - min.y),max.z - min.z);
    int texSize=(int)(maxExtent * texelsPerUnit);
    info.textureWidth=texSize;
    info.textureHeight=texSize;
    glBindTexture(GL_TEXTURE_CUBE_MAP,info.openGlHandle);
    glTexStorage2D(GL_TEXTURE_CUBE_MAP,1,GL_RG16F,texSize,texSize);
    glBindTexture(GL_TEXTURE_CUBE_MAP,0);
    info.bindlessImageHandle=ARBBindlessTexture.glGetImageHandleARB(info.openGlHandle,0,true,0,GL_RG16F);
    info.bindlessTextureAndSamplerHandle=ARBBindlessTexture.glGetTextureSamplerHandleARB(info.openGlHandle,sampler);
    ARBBindlessTexture.glMakeImageHandleResidentARB(info.bindlessImageHandle,GL_READ_WRITE);
    ARBBindlessTexture.glMakeTextureHandleResidentARB(info.bindlessTextureAndSamplerHandle);
    photonMapTextures[i]=info;
  }
  clearPhotonMapTextures();
  updateImageHandlesUbo();
  updateSamplerHandlesUbo();
}

private void createPhotonMapTextures ( ) { IntBuffer textures = BufferUtils . createIntBuffer ( photonMapTextures . length ) ; glGenTextures ( textures ) ; for ( int i = 0 ; i < photonMapTextures . length ; i ++ ) { TextureInfo info = new TextureInfo ( ) ; info . openGlHandle = textures . get ( i ) ; Vector3f min = boxes [ 2 * i + 0 ] ; Vector3f max = boxes [ 2 * i + 1 ] ; float maxExtent = Math . max ( Math . max ( max . x - min . x , max . y - min . y ) , max . z - min . z ) ; int texSize = ( int ) ( maxExtent * texelsPerUnit ) ; info . textureWidth = texSize ; info . textureHeight = texSize ; glBindTexture ( GL_TEXTURE_CUBE_MAP , info . openGlHandle ) ; glTexStorage2D ( GL_TEXTURE_CUBE_MAP , 1 , GL_RG16F , texSize , texSize ) ; glBindTexture ( GL_TEXTURE_CUBE_MAP , 0 ) ; info . bindlessImageHandle = ARBBindlessTexture . glGetImageHandleARB ( info . openGlHandle , 0 , true , 0 , GL_RG16F ) ; info . bindlessTextureAndSamplerHandle = ARBBindlessTexture . glGetTextureSamplerHandleARB ( info . openGlHandle , sampler ) ; ARBBindlessTexture . glMakeImageHandleResidentARB ( info . bindlessImageHandle , GL_READ_WRITE ) ; ARBBindlessTexture . glMakeTextureHandleResidentARB ( info . bindlessTextureAndSamplerHandle ) ; photonMapTextures [ i ] = info ; } clearPhotonMapTextures ( ) ; updateImageHandlesUbo ( ) ; updateSamplerHandlesUbo ( ) ; }
create the cubemap texture array for our photon map .
