314 reputation
115
bio website
location Italy
age 25
visits member for 8 months
seen 13 hours ago
stats profile views 10

Sep
24
comment sprite animation in openGL
20 if you are using a 5x4 sprite, 4 if you are using a 4x1 sprite by the way post the updated code
Sep
24
comment sprite animation in openGL
Sorry, just noticed an error, you need to set number_of_sprites = 4, not 1... Sorry for the mistake
Sep
24
comment returning correct multiTouch id
ok, was just a thought
Sep
24
comment sprite animation in openGL
Please update the code in your question
Sep
24
revised sprite animation in openGL
added 2 characters in body
Sep
24
comment sprite animation in openGL
See my edited answer, you can set number_of_sprites=1 and rf=1.f and that will work for 4 columns 1 row spriteset. You can stop the animation preventing idx to change. for example, save the current idx in an old_idx variable. then replace int idx = ... with int idx = collisionOccurred ? old_idx : ... where ... is the same code
Sep
24
revised sprite animation in openGL
added 1082 characters in body
Sep
24
comment sprite animation in openGL
I will edit the answer
Sep
24
answered returning correct multiTouch id
Sep
24
comment sprite animation in openGL
@Sid found the problem, use gl.glTranslatef((idx%2)/2.f, (idx/2)/2.f, 0); instead of gl.glTranslatef((idx%2)/2, (idx/2)/2, 0);
Sep
24
comment sprite animation in openGL
Uhm.. it's strange.. Can you send me your project? I will try that. By the way, no need to call gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); twice.
Sep
24
awarded  Teacher
Sep
24
awarded  Commentator
Sep
24
comment sprite animation in openGL
@Sid you need to put int idx = (int) ((System.currentTimeMillis()%(200*4))/200); INSIDE your draw function (1st line) not above in the class otherwise idx will not change it's value
Sep
24
answered Which version of OpenGL for Android?
Sep
24
awarded  Editor
Sep
24
comment sprite animation in openGL
@Sid see my edited answer, I have totally forgot that you need to reset the texture matrix. That's why your background was translated. Place that code snipped at the end of your draw function and it should work.
Sep
24
revised sprite animation in openGL
added 272 characters in body
Sep
24
comment sprite animation in openGL
Ok, where is int idx = ((System.currentTimeMillis()%(200*4))/200); ?? without that it can't work.. Also, you didn't tell me, are you using the same draw function for sprite and background?
Sep
24
comment sprite animation in openGL
@Sid post your updated code, I will check that