GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL12.GL_TEXTURE_WRAP_R, GL11.GL_CLAMP);
GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL12.GL_TEXTURE_3D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
sTex.addItem(texture.hashCode(), new Item(buffer, texture.toTexScratchDataStore()));
/**
* PBO loading
*/
if (ext.PixelBufferObjects.GL_isAvailable() && texture.accessPixelBuffer().limit() != 0) {
if (!sPbo.hasItem(pboHash)) {
sPbo.genVRAMBuffersMap(1);
sPbo.addItem(pboHash, new Item(sPbo.getVRAMFindVacant(), BufferIO._new(0)));
}
Item pboItem = sPbo.firstItem(pboHash);
ARBPixelBufferObject.glBindBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, pboItem.name);
ARBPixelBufferObject.glBufferDataARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, texture.accessPixelBuffer().limit() * BufferIO.Data._findType(texture.accessPixelBuffer()).byteSize, ARBPixelBufferObject.GL_STREAM_COPY_ARB);
sPbo.firstItem(pboHash).data = ARBPixelBufferObject.glMapBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, ARBPixelBufferObject.GL_WRITE_ONLY_ARB, texture.accessPixelBuffer().limit() * BufferIO.Data._findType(texture.accessPixelBuffer()).byteSize, null);
}
/**
* PBO loading
*/
if (ext.PixelBufferObjects.GL_isAvailable() && texture.accessPixelBuffer().limit() != 0) {
ByteBuffer b = (ByteBuffer) sPbo.firstItem(pboHash).data;
put(texture.getPixelBufferDataType(), b, texture.getPixelBuffer());
b.flip();
ARBPixelBufferObject.glUnmapBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB);
GL12.glTexImage3D(GL12.GL_TEXTURE_3D, 0, texture.getRenderFormat(), texture.getWidth(), texture.getHeight(), texture.getDepth(), 0, texture.getEXTabgr(), texture.getTextureBufferDataType(), 0);
} else {
glloadTexture3D(texture);
}
if (JXAenvUtils._debug) {
System.out.println("xxxx VRAM xxxx BYTE tex3D");
}
GL11.glBindTexture(GL12.GL_TEXTURE_3D, 0);
if (ext.PixelBufferObjects.GL_isAvailable() && texture.accessPixelBuffer().limit() != 0) {
ARBPixelBufferObject.glBindBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, 0);
if (!pboKeep) {
sPbo.removeItems(pboHash);
}
}
if (JXAenvUtils._debug) {
System.out.println("xxxx VRAM xxxx new TEX3D input : " + texture + " bufferSize : " + sTex.getItemScratchSize() + "/" + sTex.getItemScratchCapacity());
}
GL11.glPrioritizeTextures(BufferIO._wrapi(new int[]{buffer}), BufferIO._wrapf(new float[]{texture.getPty()}));
} else {
buffer = sTex.firstItemBufferName(hash);
}
} else if (texture2D != null) {
GL11.glBindTexture(GL12.GL_TEXTURE_3D, buffer);
IntBuffer dim = sTex.firstItem(hash).data;
sTex.addItem(texture2D.hashCode(), new Item(buffer, BufferIO._wrapi(new int[]{dim.get(0), dim.get(1), dim.get(2), dim.get(3), rCoord})));
texture2D.validatePixelBuffer();
/**
* PBO loading
*/
if (ext.PixelBufferObjects.GL_isAvailable()) {
if (!sPbo.hasItem(pboHash)) {
sPbo.genVRAMBuffersMap(1);
sPbo.addItem(pboHash, new Item(sPbo.getVRAMFindVacant(), BufferIO._new(0)));
}
Item pboItem = sPbo.firstItem(pboHash);
ARBPixelBufferObject.glBindBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, pboItem.name);
ARBPixelBufferObject.glBufferDataARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, texture2D.accessPixelBuffer().limit() * BufferIO.Data._findType(texture2D.accessPixelBuffer()).byteSize, ARBPixelBufferObject.GL_STREAM_COPY_ARB);
sPbo.firstItem(pboHash).data = ARBPixelBufferObject.glMapBufferARB(ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB, ARBPixelBufferObject.GL_WRITE_ONLY_ARB, texture2D.accessPixelBuffer().limit() * BufferIO.Data._findType(texture2D.accessPixelBuffer()).byteSize, null);
}
/**