Marco Martinelli
Reputation
421
Top tag
Next privilege 500 Rep.
Access review queues
 Oct 1 comment Rotate triangle so that its tip points in the direction of the point on the screen that we last touched No, scale as in `touchPos.x = (2*event.getX())/getWidth() -1.f;` Oct 1 comment Rotate triangle so that its tip points in the direction of the point on the screen that we last touched Yes it is the same use mx,my instead of rx,ry. I've supposed that your opengl screen coordinates goes from the top-left corner (-1,1) to the bottom-right corner (1,-1) If you are using different screen coordinates just scale event.getX() and event.getY() in according to them. Oct 1 comment Is it possible to emulate a MovieTexture with dynamically loaded images? How long is the video? Framerate? Oct 1 comment Rotate triangle so that its tip points in the direction of the point on the screen that we last touched ok, assuming that (rx,ry) is the center of rotation you need to do `touchPos.x-=rx; touchPos.y-=ry;` Sep 29 comment Sprite animation in openGL - Some frames are being skipped I don't mind, I've asked you just to know if it work or not. I'm curious ;) Sep 29 comment Sprite animation in openGL - Some frames are being skipped Did you tested my code? Sep 28 comment Rotate triangle so that its tip points in the direction of the point on the screen that we last touched The center of rotation of the new triangle is (0,0,0) or something else? Sep 28 revised Rotate triangle so that its tip points in the direction of the point on the screen that we last touched more details Sep 27 answered Rotate triangle so that its tip points in the direction of the point on the screen that we last touched Sep 27 answered How can I draw crisp per-pixel images with OpenGL ES on Android? Sep 27 answered Using an iPhone as a controller for a flash game Sep 26 revised Sprite animation in openGL - Some frames are being skipped add modified class Sep 26 comment Sprite animation in openGL - Some frames are being skipped Ok I'm editing the answer Sep 26 comment Sprite animation in openGL - Some frames are being skipped Ok I will try to explain it better, do you prefear to edit your Renderer class (easy) or only FragileSquare? Sep 26 comment Sprite animation in openGL - Some frames are being skipped Sorry, I was adding another comment because of the characters limit. No in the 1st idea you neet to replace System.currentTimeMillis() with (System.currentTimeMillis()-MyRenderer.flag2) Sep 26 comment Sprite animation in openGL - Some frames are being skipped delta is now the amount of milliseconds between each call to the draw method. In your `if(MyRender.flag2==1)` replace System.currentTimeMillis() with `t+=delta;` I forgot to tell you that you need to declare `int t;` near `int delta;` If you want to repeat the animation every time there is a collision you need to reset t to 0 when there is not a collision (example, add an else{ t=0; }) Sep 26 comment Sprite animation in openGL - Some frames are being skipped Ok, I have two solutions. In your renderer class set flag2=System.currentTimeMillis() instead of 1 when there is a collision, 0 otherwise. In the draw function replace if(MyRender.flag2==1) with if(MyRender.flag2>0). MyRender.flag2 is now your timestamp and you are still using one static member. Second idea, in your FragileSquare class add a member `long timestamp=System.currentTimeMillis();` and another one `int delta;` At the beginning of your draw method add `delta = System.currentTimeMillis(); timestamp=System.currentTimeMillis();` Sep 26 answered Sprite animation in openGL - Some frames are being skipped Sep 26 comment Sprite animation in openGL - Some frames are being skipped The frames that are being skipped are the firsts? Sep 26 comment Sprite animation in openGL - Some frames are being skipped Your sprite is 5x4 so `float rowFloat = 4.0f;` shoudn't be `float rowFloat = 5.0f;`? Also your textureCoord array is incorrect for that sprite, you should use 0.20f as v coordinate because it's 1.0/5;