I am trying to optimize the OpenGL ES rendering pipeline, along with
general optimizations for a proof of concept.  One thing I did was to
take vertex and texture coordinate float[] data and FloatBuffer that
are passed to gl*Pointer methods and convert them into int[] data and
IntBuffer objects, because I am using GL_FIXED and fixed point math.

After initializing/allocateDirect()'ing the IntBuffers and put()'ing
the int[] data in them for the first time, the render() method is
called once per frame.  After the rendering, the int[] data is updated
for both vertex and texture data.  Then, the following methods are
called on the IntBuffer objects:
   -vertices_buffer.clear()
   -vertices_buffer.put(vertices) // vertices is a int []
   -vertices_buffer.position(0)

This was not problem when using float[] and FloatBuffer, but a
BufferOverflowException is being thrown on that call to put().  The
API says this is only thrown when the remaining size of the IntBuffer
is less than the length of the int[] passed in.  Well, both of those
values are output to the log on the line just prior to calling put()
(intBuf.remaining() and intArr.length).  They both output 600, and
last I checked 600 is not less than 600!

I figure I am missing something simple.  I checked the call made to
allocateDirect() and it looks like this:
   -vertices_direct = ByteBuffer.allocateDirect (vertices.length *
(Integer.SIZE >> 3));
   -vertices_direct.order (ByteOrder.nativeOrder ());
   -vertices_buffer = vertices_direct.asIntBuffer();

The original code (using floating point math and Android SDK m3-rc37a)
can be found here:
http://www.enfis.it/wp-content/uploads/2008/01/tunnel3d.zip
http://www.enfis.it/archives/14

Obviously, I had to convert the original code up to Android SDK 1.0
r2.  I ended up using EGL as I did not see a way around it.  Keep in
mind I have little OpenGL experience, let alone ES 1.0 on Android.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to