summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Palevich <jackpal@google.com>2010-06-22 20:08:40 +0800
committerJack Palevich <jackpal@google.com>2010-06-22 20:08:40 +0800
commit224107a421e2611b15d1ec736df54bca9ee3e78d (patch)
tree7947fa03cc7f65a001a6b899d20f9a848a80e6a6
parent07ccf5ad7edfeeebb79208ad3e8a52917fe038a8 (diff)
downloadframeworks_base-224107a421e2611b15d1ec736df54bca9ee3e78d.zip
frameworks_base-224107a421e2611b15d1ec736df54bca9ee3e78d.tar.gz
frameworks_base-224107a421e2611b15d1ec736df54bca9ee3e78d.tar.bz2
Add OpenGL ES 2.0 VBO versions glDrawElements and glVertexAttribPointer.
Change-Id: Id0069535e97fe96eef74e4d0c1d19b010061fe3b
-rw-r--r--api/current.xml42
-rw-r--r--core/jni/android_opengl_GLES20.cpp28
-rw-r--r--opengl/java/android/opengl/GLES10.java16
-rw-r--r--opengl/java/android/opengl/GLES20.java84
-rw-r--r--opengl/tools/glgen/specs/gles11/GLES20.spec4
-rw-r--r--opengl/tools/glgen/src/JniCodeEmitter.java2
6 files changed, 174 insertions, 2 deletions
diff --git a/api/current.xml b/api/current.xml
index 38ba53a..78e0e40 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -109169,6 +109169,25 @@
</parameter>
<parameter name="type" type="int">
</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glDrawElements"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="mode" type="int">
+</parameter>
+<parameter name="count" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
<parameter name="indices" type="java.nio.Buffer">
</parameter>
</method>
@@ -111587,6 +111606,29 @@
<method name="glVertexAttribPointer"
return="void"
abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="indx" type="int">
+</parameter>
+<parameter name="size" type="int">
+</parameter>
+<parameter name="type" type="int">
+</parameter>
+<parameter name="normalized" type="boolean">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+</method>
+<method name="glVertexAttribPointer"
+ return="void"
+ abstract="false"
native="false"
synchronized="false"
static="true"
diff --git a/core/jni/android_opengl_GLES20.cpp b/core/jni/android_opengl_GLES20.cpp
index fd1c8fd..ef25319 100644
--- a/core/jni/android_opengl_GLES20.cpp
+++ b/core/jni/android_opengl_GLES20.cpp
@@ -823,6 +823,18 @@ android_glDrawArrays__III
);
}
+/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
+static void
+android_glDrawElements__IIII
+ (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
+ glDrawElements(
+ (GLenum)mode,
+ (GLsizei)count,
+ (GLenum)type,
+ (const GLvoid *)offset
+ );
+}
+
/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
static void
android_glDrawElements__IIILjava_nio_Buffer_2
@@ -4786,6 +4798,20 @@ android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2
}
}
+/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */
+static void
+android_glVertexAttribPointer__IIIZII
+ (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) {
+ glVertexAttribPointer(
+ (GLuint)indx,
+ (GLint)size,
+ (GLenum)type,
+ (GLboolean)normalized,
+ (GLsizei)stride,
+ (const GLvoid *)offset
+ );
+}
+
/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */
static void
android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I
@@ -4872,6 +4898,7 @@ static JNINativeMethod methods[] = {
{"glDisable", "(I)V", (void *) android_glDisable__I },
{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I },
{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
+{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
{"glEnable", "(I)V", (void *) android_glEnable__I },
{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I },
@@ -5011,6 +5038,7 @@ static JNINativeMethod methods[] = {
{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF },
{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI },
{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 },
+{"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII },
{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I },
{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
};
diff --git a/opengl/java/android/opengl/GLES10.java b/opengl/java/android/opengl/GLES10.java
index db52b82..790acbd 100644
--- a/opengl/java/android/opengl/GLES10.java
+++ b/opengl/java/android/opengl/GLES10.java
@@ -669,6 +669,22 @@ public class GLES10 {
java.nio.IntBuffer params
);
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
// C function const GLubyte * glGetString ( GLenum name )
public static native String glGetString(
diff --git a/opengl/java/android/opengl/GLES20.java b/opengl/java/android/opengl/GLES20.java
index b8aac0e..635f811 100644
--- a/opengl/java/android/opengl/GLES20.java
+++ b/opengl/java/android/opengl/GLES20.java
@@ -670,6 +670,15 @@ public class GLES20 {
int count
);
+ // C function void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset )
+
+ public static native void glDrawElements(
+ int mode,
+ int count,
+ int type,
+ int offset
+ );
+
// C function void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
public static native void glDrawElements(
@@ -978,6 +987,22 @@ public class GLES20 {
java.nio.IntBuffer params
);
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
// C function void glGetProgramInfoLog( GLuint program, GLsizei maxLength, GLsizei * length,
// GLchar * infoLog);
@@ -1018,6 +1043,22 @@ public class GLES20 {
java.nio.IntBuffer params
);
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
// C function void glGetShaderInfoLog( GLuint shader, GLsizei maxLength, GLsizei * length,
// GLchar * infoLog);
@@ -1064,6 +1105,22 @@ public class GLES20 {
byte source
);
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
// C function const GLubyte * glGetString ( GLenum name )
public static native String glGetString(
@@ -1316,6 +1373,22 @@ public class GLES20 {
int length
);
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
// C function void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint* length )
public static native void glShaderSource(
@@ -1814,6 +1887,17 @@ public class GLES20 {
java.nio.FloatBuffer values
);
+ // C function void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset )
+
+ public static native void glVertexAttribPointer(
+ int indx,
+ int size,
+ int type,
+ boolean normalized,
+ int stride,
+ int offset
+ );
+
// C function void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr )
private static native void glVertexAttribPointerBounds(
diff --git a/opengl/tools/glgen/specs/gles11/GLES20.spec b/opengl/tools/glgen/specs/gles11/GLES20.spec
index 61094d1..ee88f59 100644
--- a/opengl/tools/glgen/specs/gles11/GLES20.spec
+++ b/opengl/tools/glgen/specs/gles11/GLES20.spec
@@ -39,6 +39,7 @@ void glDetachShader ( GLuint program, GLuint shader )
void glDisable ( GLenum cap )
void glDisableVertexAttribArray ( GLuint index )
void glDrawArrays ( GLenum mode, GLint first, GLsizei count )
+void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset )
void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
void glEnable ( GLenum cap )
void glEnableVertexAttribArray ( GLuint index )
@@ -138,5 +139,6 @@ void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z )
void glVertexAttrib3fv ( GLuint indx, const GLfloat *values )
void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
void glVertexAttrib4fv ( GLuint indx, const GLfloat *values )
+void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset )
void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr )
-void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) \ No newline at end of file
+void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index ebaca90..9d8c5a0 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -695,7 +695,7 @@ public class JniCodeEmitter {
boolean isPointerFunc = isPointerFunc(jfunc);
boolean isVBOPointerFunc = (outName.endsWith("Pointer") ||
outName.endsWith("PointerOES") ||
- outName.endsWith("DrawElements")) &&
+ outName.endsWith("DrawElements") || outName.endsWith("VertexAttribPointer")) &&
!jfunc.getCFunc().hasPointerArg();
if (isPointerFunc) {
outName += "Bounds";