On Mon, Dec 19, 2011 at 9:12 AM, Raghav Dwivedi
<[email protected]> wrote:
> private void initTriangle(){
> //Float has 4 Bytes
> ByteBuffer vbb = ByteBuffer.allocateDirect(_nr0fvertices *3 *4);
> vbb.order(ByteOrder.nativeOrder());
> _vertexBuffer = vbb.asFloatBuffer();
> //Short has 4 Bytes
> ByteBuffer ibb = ByteBuffer.allocateDirect(_nr0fvertices * 2);
> ibb.order(ByteOrder.nativeOrder());
> _indexBuffer = ibb.asShortBuffer();
> //Float has 4 Bytes, 4 Colors (RGBA)*no of vertices*4 Bytes
> ByteBuffer cbb = ByteBuffer.allocate(4*_nr0fvertices*4);

I guess the logged exception pretty much says it all: note that unlike
your other buffers, you allocate your colour buffer using allocate(),
not allocateDirect().  Try using allocateDirect(), I think that should
fix it.

-- 
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