weston
weston

Reputation: 54811

Trying to implement VBOs in OPENGL 2 on API 8 (2.2)

I am stuck on how to tell Open Gl about the layout of my VBO, or rather, tell the program where stuff is.

//bind buffer
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vboBuffer);
//find shader attribute
int ref = GLES20.glGetAttribLocation(mProgram, "aPosition");
//set up vertex
GLES20.glVertexAttribPointer(maPositionHandle, 3,
                             GLES20.GL_FLOAT, false,
                TRIANGLE_VERTICES_DATA_STRIDE_BYTES, ???);
//enable attrib
GLES20.glEnableVertexAttribArray(maPositionHandle);

And repeat for normals and texture coords.

However, in API 8, there is only:

glVertexAttribPointer(int indx, int size, int type,
                      boolean normalized, int stride, Buffer ptr)

and not:

glVertexAttribPointer(int indx, int size, int type,
                      boolean normalized, int stride, int offset)

So given I can't put an offset in API 8, what do I put in the Buffer param?

Upvotes: 1

Views: 342

Answers (1)

the swine
the swine

Reputation: 11031

sadly, VBOs can not be used with API 8 (Android 2.2). You need to update to API 9 (Android 2.3), where this bug was fixed. Or you have to stick to old good ByteBuffer.

Hope this helps ...

Upvotes: 1

Related Questions