Cool ! It worked... Thanx a lot
I wasn't doing anything different than just using the float versions
of the same function .. wonder why it wasn't working for me ?
I am posting more observations which might help someone else.
I can see the sample cube application using the GLSurfaceView and
provides a Renderer interface for reusing that code very easily. All I
have to do is write a new class which extends Renderer and pass it to
setRenderer.... (Correct me if I am wrong)
BUT I am using only one thread !!! I initialize the OpenGL and render
NOT on a different thread like I assume most of you here are doing..
On each touch event I call a draw function whose body is quoted below
//CODE BEGINS
/* I do this after binding and loading the texture image which is
320x480
((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D,
GL11Ext.GL_TEXTURE_CROP_RECT_OES,
new int[] {0, 0, 320, 480}, 0);
*/
public final void draw()
{
long now = System.nanoTime();
GL10 l_gl = gl;
int sss = GL10.GL_BLEND;
l_gl.glDisable(sss);
l_gl.glBindTexture(GL10.GL_TEXTURE_2D, t);
((GL11Ext)l_gl).glDrawTexiOES(0, 0, 0, 320, 480);
l_gl.glEnable(sss);
now = System.nanoTime() - now;
System.out.println(1000000000/now);
}
//CODE ENDS
LogCat output from Println shows - 26 or 27 if I click and release at
a very very slow rate.. and drops almost below 20 when I click and
drag mouse which I assume is because of the touch event eating the CPU
cycle which was discussed in another thread.
Is my math to measure fps correct ? Is this the maximum potential of
OpenGL on Android ?
I tried using 256x256, 512x512 textures scaled to 320x480 and
performance numbers are just the same
Thanks to Android team for their beautiful performance optimization
document.
I use final, static, local declarations of references whenever
possible now... and I can see a huge difference.
On Feb 16, 6:47 pm, Jon Colverson <[email protected]> wrote:
> On Feb 16, 12:57 pm, quakeboy <[email protected]> wrote:
>
> > but still my speed drops when I draw the background as a textured
> > quad. and I am not able to get the drawtexfOES to work.
>
> > @Jon
> > Can you please help me by posting a sample code of what parameters to
> > pass to
>
> > 1. glTexParameterfv
> > 2. glDrawTexfOES
>
> > to get them to paint the texture properly. I get a red color only, and
> > not the actual texture. I use a 2d ortho with 320,480 as extents..
> > with ortho camera's bottom left at 0,0
>
> This is what I'm doing:
>
> gl.glBindTexture(GL10.GL_TEXTURE_2D, name);
> GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, b, 0);
> ((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D,
> GL11Ext.GL_TEXTURE_CROP_RECT_OES,
> new int[] {0, 0, 320, 480}, 0);
>
> ((GL11Ext) gl).glDrawTexiOES(0, 0, 0, 320, 480);
>
> Could the problem be not binding the texture before setting the
> parameters?
>
> --
> Jon
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---