Question

I am writing some android code in preparation for a graphics intensive app I plan to develop. I haven't done any OpenGL since 2004. I stumbled across http://www.opengl.org/wiki/Vertex_Array_Object and multiple sources for the PC platform claim that using vertex-array-objects is the best way to render.

My target platform is a Motorola Atrix 2 smart-phone with Android 2.3.

I can't seem to find an include for a function corresponding to GL_OES_vertex_array_object. I want to call functions similar to glGenVertexArraysOES.

How do I use VAOs in Android?

My current includes are

import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.CharBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;

import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.opengles.GL11;
Was it helpful?

Solution

VAOs are fairly new and not included in OpenGL|ES 1.0 or 1.1 (not to be confused with Buffer Objects, or as they're sometimes called VBOs). You'll have to import and use OpenGL|ES 2.0, and by doing that you'll have to make some changes to your graphics code to draw via shaders instead of glVertexPointer and similar methods. From the looks of it, there's no GL20Ext class or similar built into Android, I would look around the web for bindings or write them myself using the NDK.

OTHER TIPS

On some devices the VAO extension is not implemented. First check the OpenGl ES version with

gl.glGetString(GL10.GL_VERSION);

Then check if the extension is availbale with

gl.glGetString(GL10.GL_EXTENSIONS);

it should contain: GL_OES_vertex_array_object

For more info about extensions: OpenGL extensions available on different Android devices

For more info about VAOs on android check: OES_vertex_array_object and client state

Edit: Change answer to respond the question right. Thx for the comment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top