本文整理汇总了Java中org.lwjgl.opengl.GL15.glBufferSubData方法的典型用法代码示例。如果您正苦于以下问题:Java GL15.glBufferSubData方法的具体用法?Java GL15.glBufferSubData怎么用?Java GL15.glBufferSubData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL15
的用法示例。
在下文中一共展示了GL15.glBufferSubData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateData
import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public VBO updateData(IntBuffer buffer, long offset)
{
if (this.type != GL11.GL_UNSIGNED_INT)
{
throw new IllegalArgumentException("Cannot store mismatching type in buffer!");
}
if (offset + buffer.limit() > this.length)
{
int usage = GL15.glGetBufferParameteri(this.target, GL15.GL_BUFFER_USAGE);
this.putData(buffer, this.normalized, usage);
}
GL15.glBindBuffer(this.target, this.handle);
GL15.glBufferSubData(this.target, offset, buffer);
return this;
}
示例2: loadChunk
import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
private void loadChunk(int id, Shader shader, ExtendedBlockStorage storage) {
ObjectIntIdentityMap<IBlockState> map = GameData.getBlockStateIDMap();
int[] data = new int[chunkSize*2];
for (int y = 0; y < 16; y++) {
for (int z = 0; z < 16; z++) {
for (int x = 0; x < 16; x++) {
IBlockState state = storage.get(x, y, z);
boolean fullBlock = state.isFullBlock();
boolean cube = state.isFullCube();
if (fullBlock != cube) {
Log.info(state.getBlock().getUnlocalizedName() + ": " + fullBlock);
}
if (fullBlock) {
stateSet.add(state);
}
int stateId = map.get(state); //TODO
data[(y<<9) + (z<<5) + (x<<1)] = Block.getIdFromBlock(storage.get(x, y, z).getBlock());
}
}
}
for (int y = 0; y < 16; y++) {
for (int z = 0; z < 16; z++) {
for (int x = 0; x < 16; x++) {
data[(y<<9) + (z<<5) + (x<<1) + 1] = storage.getBlocklightArray().get(x, y, z);
}
}
}
IntBuffer buffer = BufferUtils.createIntBuffer(chunkSize*2);
buffer.put(data);
buffer.flip();
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shader.getChunkSsbo());
GL15.glBufferSubData(GL43.GL_SHADER_STORAGE_BUFFER, (id-1)*chunkSize*2*4, buffer);
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
}
示例3: loadMetadata
import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
/**
*
* @param id
* @param shader
* @param storage
* @return true if the id was used, false if there was nothing to upload
*/
private boolean loadMetadata(int id, Shader shader, ExtendedBlockStorage storage) {
int[] data = new int[chunkSize];
boolean containsValues = false;
for (int y = 0; y < 16; y++) {
for (int z = 0; z < 16; z++) {
for (int x = 0; x < 16; x++) {
int metadata = storage.get(x, y, z).getBlock().getMetaFromState(storage.get(x, y, z));
data[(y<<8) + (z<<4) + x] = metadata;
if (metadata != 0) {
containsValues = true;
}
}
}
}
if (containsValues) {
IntBuffer buffer = BufferUtils.createIntBuffer(chunkSize);
buffer.put(data);
buffer.flip();
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shader.getMetadataSsbo());
GL15.glBufferSubData(GL43.GL_SHADER_STORAGE_BUFFER, (id-1)*chunkSize*4, buffer);
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
}
return containsValues;
}
示例4: storeData
import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public void storeData(long startInBytes, IntBuffer data){
GL15.glBufferSubData(type, startInBytes, data);
}
示例5: storeData
import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public void storeData(long startInBytes, IntBuffer data) {
GL15.glBufferSubData(type, startInBytes, data);
}