v0.7.4b: Initial LibGDX commit! more details below:
Large sections of game logic are now working through libgdx instead of android libraries. There is still work to do but this is the first major step. Big changes include: - Graphics code is now through LibGDX (except for text rendering) - Initialization and screen-handling logic is now mostly through LibGDX - Audio is now through LibGDX - Input handling is now through LibGDX - Most misc functions are now through LibGDX
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
|
||||
package com.watabou.glwrap;
|
||||
|
||||
import android.opengl.GLES20;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.ArrayList;
|
||||
@@ -36,9 +36,7 @@ public class Vertexbuffer {
|
||||
|
||||
public Vertexbuffer( FloatBuffer vertices ) {
|
||||
synchronized (buffers) {
|
||||
int[] ptr = new int[1];
|
||||
GLES20.glGenBuffers(1, ptr, 0);
|
||||
id = ptr[0];
|
||||
id = Gdx.gl.glGenBuffer();
|
||||
|
||||
this.vertices = vertices;
|
||||
buffers.add(this);
|
||||
@@ -80,9 +78,9 @@ public class Vertexbuffer {
|
||||
bind();
|
||||
|
||||
if (updateStart == 0 && updateEnd == vertices.limit()){
|
||||
GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, vertices.limit()*4, vertices, GLES20.GL_DYNAMIC_DRAW);
|
||||
Gdx.gl.glBufferData(Gdx.gl.GL_ARRAY_BUFFER, vertices.limit()*4, vertices, Gdx.gl.GL_DYNAMIC_DRAW);
|
||||
} else {
|
||||
GLES20.glBufferSubData(GLES20.GL_ARRAY_BUFFER, updateStart*4, (updateEnd - updateStart)*4, vertices);
|
||||
Gdx.gl.glBufferSubData(Gdx.gl.GL_ARRAY_BUFFER, updateStart*4, (updateEnd - updateStart)*4, vertices);
|
||||
}
|
||||
|
||||
release();
|
||||
@@ -90,16 +88,16 @@ public class Vertexbuffer {
|
||||
}
|
||||
|
||||
public void bind(){
|
||||
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, id);
|
||||
Gdx.gl.glBindBuffer(Gdx.gl.GL_ARRAY_BUFFER, id);
|
||||
}
|
||||
|
||||
public void release(){
|
||||
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
|
||||
Gdx.gl.glBindBuffer(Gdx.gl.GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
public void delete(){
|
||||
synchronized (buffers) {
|
||||
GLES20.glDeleteBuffers(1, new int[]{id}, 0);
|
||||
Gdx.gl.glDeleteBuffer( id );
|
||||
buffers.remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user