0

I'm using the GWT canvas to draw 50 identical 16x16 Images full screen (in draw()) with the requestAnimationFrame, the main loop is below:

AnimationScheduler.get().requestAnimationFrame(new AnimationCallback() {
                    public void execute(double timestamp) {
                        mainLoop(deltaTimeInMs);
                        AnimationScheduler.get().requestAnimationFrame(this,canvasElem);
                    }
                }, canvasElem);


void mainLoop(double deltaTime) {
        calcFPS(deltaTime);
        clearContext();
        update(deltaTime);
        draw();
}

I store the images using the ClientBundle as DataResources. They are converted to images and to an ImageElement to be able to call context.draw.

The FPS before the 50 images are rendered is around 60FPS. When they are rendered the FPS are around 20FPS. (both in chrome and mozilla) in DEV mode.

I think the image loading might be of a problem.

Vjeetje
  • 5,314
  • 5
  • 35
  • 57
  • The reason it runs so slow is DEV mode. In the GWT 2.5+ versions it runs fine on SDM (superdev mode). – Vjeetje Aug 02 '13 at 19:11

1 Answers1

-3
AnimationScheduler.get().requestAnimationFrame(new AnimationCallback() {
                    public void execute(double timestamp) {
                        mainLoop(deltaTimeInMs);
                        AnimationScheduler.get().requestAnimationFrame(this,canvasElem);
                    }
                }, canvasElem);


void mainLoop(double deltaTime) {
        calcFPS(deltaTime);
        clearContext();
        update(deltaTime);
  • Would you care to add some explanations to your solution? Why is it faster than the original question? IS it faster? – Manuel Jul 23 '13 at 09:00
  • 1
    it's a troll answer... He just removed the draw() call. Please downvote this – Vjeetje Jul 23 '13 at 09:01