List of usage examples for org.lwjgl.opengl ARBBindlessTexture glMakeTextureHandleResidentARB
public static native void glMakeTextureHandleResidentARB(@NativeType("GLuint64") long handle);
From source file:org.lwjgl.demo.opengl.raytracing.PhotonMappingBindlessDemo.java
License:Open Source License
/** * Create the cubemap texture array for our photon map. *//*from w w w .ja va2s.co m*/ private void createPhotonMapTextures() { /* Create them */ 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; } /* Clear them */ clearPhotonMapTextures(); /* Update SSBO with bindless image handles */ updateImageHandlesUbo(); /* Update UBO with bindless sampler handles */ updateSamplerHandlesUbo(); }