Try to disable glBindTexture(), for use this call you have  forgotten
two things:

1)      gl.glEnable(GL11.GL_TEXTURE_2D); // enable

2)      GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, image_data, 0); //
set data

try to remove the call for see if these things are the problem or not.

I hope it solve problem, bye



On 5 Gen, 17:15, Nightwolf <mikh...@gmail.com> wrote:
> The first obviously wrong thing is creating new objects in
> onDrawFrame.
>
> AFAIK buffers passed to glVertexPointer and glTexCoordPointer have to
> be direct buffers. Take a look at APIDemos.
> Allocation code should look similar to this
>
> bb = ByteBuffer.allocateDirect();
> bb.order(ByteOrder.nativeOrder());
> mVertexBuffer = bb.asFloatBuffer();
>
> On 31 дек 2010, 02:19, bob <b...@coolgroups.com> wrote:> I'm having trouble 
> getting my Android opengl app to display a quad. Is
> > there anything obviously wrong with this code?
>
> > public void onDrawFrame(GL10 gl) {
> > gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
> > gl.glMatrixMode(GL10.GL_MODELVIEW);
> > gl.glLoadIdentity();
>
> > float[] myverts = new float[]
> > {
> > -.77f, .58f,
> > .77f, .58f,
> > .77f, -.58f,
> > -.77f, -.58f
>
> > };
>
> > FloatBuffer[] fb = new FloatBuffer[1];
> > fb[0] = FloatBuffer.wrap(myverts);
>
> > float[] mytex = new float[]
> > {
> > 0, 0,
> > 1, 0,
> > 1, 1,
> > 0, 1
>
> > };
>
> > FloatBuffer[] tfb = new FloatBuffer[1];
> > tfb[0] = FloatBuffer.wrap(myverts);
>
> > gl.glTranslatef(0, 0, -5);
>
> > gl.glBindTexture(GL10.GL_TEXTURE_2D, texturesBuffer.get(0));
> > gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
> > gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
>
> > gl.glVertexPointer(2, GL10.GL_FLOAT, 0, fb[0]);
> > gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, tfb[0]);
>
> > gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, 4);
>
> > gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
> > gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
>
> > }

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