324 reputation
137
bio website fantasyvengeance.com
location Italy
age 26
visits member for 1 year, 11 months
seen 20 hours ago

Java and Android developer with interests in 3D stuff and game development.

Linux user since 2003, self taught in electronic, former musician.

Graduated in "Computer Science" at the University of Verona (Italy) with a thesis involving ARM boards, real time OSs and custom graphic libraries.

Three time winner at the National Turing Machine Contest of the University of Pisa (Italy) back in high school.


Sep
25
awarded  Supporter
Sep
25
comment sprite animation in openGL
for the 1st problem I don't know, it's working fine here, for the second one, you need to stop idx to roll back to 0 so a simple trick is this. Declare a variable int oldIdx; before public FragileSquare() then in the draw method do this: int idx = oldIdx==(numberSprites-1) ? (numberSprites-1) : (int)((System.currentTimeMillis()%(200*numberSprites))/200); oldIdx = idx; By the way I think that we are going OT, the original question was answered, maybe you should close this one and open a new one if needed.
Sep
24
comment sprite animation in openGL
replace int idx = (int) ((System.currentTimeMillis()%(200*4))/200); with int idx = (int) ((System.currentTimeMillis()%(200*numberSprites))/200);
Sep
24
comment sprite animation in openGL
that's right, c = 7; cf = 7.f; rf = 7.f; number_of_sprites = 49; if there are other problems please update your code :)
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