It should be allocateDirect instead of allocate.

On 14 дек, 02:22, billconan <[email protected]> wrote:
> hello guys,
>
> i'm trying to draw a very simple 2D triangle with opengl. but i have
> exception "illegal parameters"
>
> the problematic line is
>
>         gl.glVertexPointer(3, GL11.GL_FLOAT, 0, mVertexBuffer);
>
> i'm new to android, my experience with it so far is so frustrating. i
> simply copied code from other examples. and it simply doesn't work.
>
> i'm pretty sure the mVertexBuffer is successfully initialized. because
> i can see the size of the buffer is 48 right before the execution of
> the problematic line with the debugger. and this size is correct.
>
> however it just doesn't work.
>
> i initialized the buffer this way:
>
>                 mVertexBuffer = ByteBuffer.allocate(12*4);
>                 mVertexBuffer.order(ByteOrder.nativeOrder());
>                 mVertexBuffer.position(0);
>                 mVertexBuffer.putFloat(-1);
>                 mVertexBuffer.putFloat(-1);
>                 mVertexBuffer.putFloat(-1);
>                 mVertexBuffer.putFloat(1);
>                 mVertexBuffer.putFloat(1);
>                 mVertexBuffer.putFloat(1);
>                 mVertexBuffer.position(0);
>
> the code was actually copied from a opensource example.
>
> can somebody help me?

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