v0.4.2: VBOs now work with android 2.2

This commit is contained in:
Evan Debenham
2016-08-22 03:40:14 -04:00
committed by Evan Debenham
parent b821bfddf8
commit 9f8981db07
6 changed files with 84 additions and 6 deletions

View File

@@ -25,8 +25,10 @@ import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
import android.opengl.GLES20;
import android.os.Build;
import com.watabou.glscripts.Script;
import com.watabou.glwrap.FroyoGLES20Fix;
import com.watabou.glwrap.Attribute;
import com.watabou.glwrap.Quad;
import com.watabou.glwrap.Uniform;
@@ -85,7 +87,6 @@ public class NoosaScript extends Script {
Quad.bindIndices();
}
//FIXME need to do some voodoo to get this working properly on android 2.2
public void drawQuad( FloatBuffer vertices ) {
vertices.position( 0 );
@@ -94,7 +95,11 @@ public class NoosaScript extends Script {
vertices.position( 2 );
aUV.vertexPointer( 2, 4, vertices );
GLES20.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE, GLES20.GL_UNSIGNED_SHORT, 0 );
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
GLES20.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE, GLES20.GL_UNSIGNED_SHORT, 0 );
} else {
FroyoGLES20Fix.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE, GLES20.GL_UNSIGNED_SHORT, 0 );
}
}
@@ -109,7 +114,11 @@ public class NoosaScript extends Script {
buffer.release();
GLES20.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE, GLES20.GL_UNSIGNED_SHORT, 0 );
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
GLES20.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE, GLES20.GL_UNSIGNED_SHORT, 0 );
} else {
FroyoGLES20Fix.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE, GLES20.GL_UNSIGNED_SHORT, 0 );
}
}
public void drawQuadSet( FloatBuffer vertices, int size ) {
@@ -124,7 +133,11 @@ public class NoosaScript extends Script {
vertices.position( 2 );
aUV.vertexPointer( 2, 4, vertices );
GLES20.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE * size, GLES20.GL_UNSIGNED_SHORT, 0 );
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
GLES20.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE * size, GLES20.GL_UNSIGNED_SHORT, 0 );
} else {
FroyoGLES20Fix.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE * size, GLES20.GL_UNSIGNED_SHORT, 0 );
}
}
@@ -143,7 +156,11 @@ public class NoosaScript extends Script {
buffer.release();
GLES20.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE * length, GLES20.GL_UNSIGNED_SHORT, Quad.SIZE * offset );
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
GLES20.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE * length, GLES20.GL_UNSIGNED_SHORT, Quad.SIZE * offset );
} else {
FroyoGLES20Fix.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE * length, GLES20.GL_UNSIGNED_SHORT, Quad.SIZE * offset );
}
}
public void lighting( float rm, float gm, float bm, float am, float ra, float ga, float ba, float aa ) {