There are a few things I see here that need some investigation.

First it looks like you're unbinding the buffer before the actual draw?

GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

Second, in the work I've done recently I found not appreciable performance 
improvement from using VBOs vs. standard vertex arrays, and my memory is a 
little shaky on the details, but aren't you supposed to have transferred 
the buffer data using a call to glBufferData?  (maybe that's elsewhere in 
the code).

There is a good synopsis on VBOs here:

http://www.learnopengles.com/android-lesson-seven-an-introduction-to-vertex-buffer-objects-vbos/

I'll re-iterate though, make your life easier and just use a vertex array. 
 You are already allocating the native buffers needed, and in my experience 
you won't get any more performance from allocating them on VRAM.

Also the previous commenter is correct (from what I can see) unless your 
stuffing color and or texture coordinate data into the buffer (which I 
can't see from the code) then the stride ought to be 0.

Some additional points:

Your rotation appears to rotate the model as well as the camera?  This will 
likely result in no visible rotation on screen as the camera is rotated by 
the same amount as the model.

Matrix.rotateM(ModelMatrix, 0, angleInDegrees, 0.0f, 0.0f, 1.0f);
Matrix.rotateM(ViewMatrix, 0, angleInDegrees, 0.0f, 0.0f, 1.0f);

Also you appear to be allocating memory within your draw call.  This is a 
bad idea as it will cause the garbage collector to thrash which will 
destroy your frame rate

float[] MVPMatrix = new float[16];

I'd also avoid using anything from the Java Collections framework as you'll 
find unexpected memory allocations going on (particularly in Map types). 
 I'd limit yourself to arrays where possible or use some of the in-built 
Android collection types (like SparseArray).

I can't see your vertex/fragment shaders, but I'm assuming their fairly 
basic.  You may be better off doing the matrix transformations in the 
shader too, although depending on the complexity of your model you may or 
may not see performance gains for this.

Simply using vertex buffers is very easy.  Rather than sending the pointer 
to the VBO in the glVertexAttribPointer call you just send the local java 
reference to your FloatBuffer objects.

That is, rather than:

public native void glVertexAttribPointer(int indx, int size, int type, 
boolean normalized, int stride, int ptr);

use this:

public native void glVertexAttribPointer(int indx, int size, int type, 
boolean normalized, int stride, Buffer ptr);

That will basically eliminate all the VBO code which (in my opinion) is 
unneccessary.

On Friday, March 15, 2013 2:05:38 PM UTC-7, Braindrool wrote:
>
> Like I said, I've tried everything I can think of. Same result. 

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to