emeric636 / apps-for-android

Automatically exported from code.google.com/p/apps-for-android
Apache License 2.0
0 stars 0 forks source link

Exception running VBO sample in SpriteMethodTest #50

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Launch SpriteMethodTest
2. Select OpenGL ES -> Use VBO Extension

What is the expected output? What do you see instead?

Expected sprite test to run, instead received the following in LogCat:

Uncaught handler: thread GLThread exiting due to uncaught exception
java.lang.IllegalArgumentException: remaining() < size
    at com.google.android.gles_jni.GLImpl.glBufferData(Native Method)
    at 
com.android.spritemethodtest.Grid.generateHardwareBuffers(Grid.java:231)
    at 
com.android.spritemethodtest.SimpleGLRenderer.surfaceCreated(SimpleGLRender
er.java:192)
    at 
com.android.spritemethodtest.GLSurfaceView$GLThread.guardedRun(GLSurfaceVie
w.java:403)
    at 
com.android.spritemethodtest.GLSurfaceView$GLThread.run(GLSurfaceView.java:
337)

What version of the product are you using? On what operating system?

Running on Android Emulator
OS: Windows 7
Eclipse: 3.5.1 (Eclipse IDE for Java Developers Build id: 20090920-1017)
Android SDK: 2.0.1

Tested on 1.5, 1.6, 2.0 and 2.0.1 emulated devices

Original issue reported on code.google.com by jason.po...@gmail.com on 28 Dec 2009 at 9:00

GoogleCodeExporter commented 9 years ago
The attached SVN patch resolves the issue for me:

Original comment by jason.po...@gmail.com on 28 Dec 2009 at 9:14

Attachments:

GoogleCodeExporter commented 9 years ago
FYI:

Grid class uses:

final int vertexSize = mVertexBuffer.capacity() * Float.SIZE;

and

final int texCoordSize = mTexCoordBuffer.capacity() * Float.SIZE;

Should be:

final int vertexSize = mVertexBuffer.capacity() * 4;

and

final int texCoordSize = mTexCoordBuffer.capacity() * 4;

Float.SIZE resolves to 32

Original comment by jason.po...@gmail.com on 28 Dec 2009 at 9:16

GoogleCodeExporter commented 9 years ago
Indeed.  Fixed.

Original comment by sm0a...@gmail.com on 19 Jan 2010 at 5:05

GoogleCodeExporter commented 9 years ago
you get the 32 because it is in bits not in bytes...
Float.SIZE/Byte.SIZE does the trick,
writing 4 is more hardcoded...

Original comment by DA0.1428...@gmail.com on 29 Dec 2012 at 4:23