better vbo support

pull/12/head
hYdos 2020-03-01 07:48:36 +10:00
parent ad4761d065
commit 2f203175bc
2 changed files with 9 additions and 1 deletions

View File

@ -61,6 +61,7 @@ public class BlockRenderer extends Renderer implements WorldGenConstants
public void prepareRender() {
//TODO: combine VBOS
shader.start();
shader.loadSkyColour(Window.getColour());
shader.loadViewMatrix(GingerRegister.getInstance().game.data.camera);

View File

@ -45,7 +45,14 @@ public class Loader
public static int createEmptyVbo(int floatCount)
{
int vbo = GL15.glGenBuffers();
int vbo;
if (Window.glContext.GL_ARB_vertex_buffer_object) { //checks if gpu can handle faster vbos
IntBuffer buffer = BufferUtils.createIntBuffer(1);
ARBVertexBufferObject.glGenBuffersARB(buffer);
vbo = buffer.get(0);
}else {
vbo = GL15.glGenBuffers();
}
vbos.add(vbo);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, floatCount * 4, GL15.GL_STREAM_DRAW);