When you move that loop behind mVertexBuffer.position(0) you'll pass
the buffer with position at the end in the draw method. You have to
reset the position after you put values into the buffer. If you do
that the demo doesn't show the errors anymore.

If this should actually even work the way you described it, then I
guess the methods that get called later should handle this. To me it
seems like openGL just reads outside the buffer that was passed. I'm
not sure if this should be tolerated.

On Jan 23, 3:06 am, Patrick <bpatm...@gmail.com> wrote:
> As a standalone app, it might be difficult, since the problem does not
> seem to occur if we look at content of the buffer through java code.
> But it does have a problem if openGL tries to access it to render, so
> to get the bug requires a lot of code around it.
>
> To get the bug to repro, in the API demos, in Cube.java :
>
> - Remove line 75.
> mVertexBuffer.put(vertices);
>
> - After the call to mVertexBuffer.position(0), add the following
> code :
>
>         for (int i = 0; i < vertices.length; i ++)
>                 mVertexBuffer.put(vertices[i]);
>
> Essentially adding vert data one entry at a time, instead of in one
> shot.
>
> You'll see the "cube" displayed is not a cube at all. The verts are
> messed up. But how it's messed up is different each time you run it.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to