Re: [android-developers] Help: getting illegal argument exception in glcolorpointer
On Mon, Dec 19, 2011 at 9:12 AM, Raghav Dwivedi
<er.raghavdwivedi@gmail.com> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home