Friday, October 26, 2012

AnimationScheduler.requestAnimationFrame example

Hi Everyone,

I am beginning to learn WebGL development using GWT using gwtgl.
I am not able to get the requestAnimationFrame working to render my scene regularly.
Could someone please take a look at it and offer some advice?

Code:

Mygwtgl.java
public class Mygwtgl implements EntryPoint, AnimationScheduler.AnimationCallback {
...
private Redraw redraw;
    private void start() {
...
redraw = new Redraw();
redraw.requestAnimationFrame(this);
}
public void execute(double timestamp) {
drawScene();
}
}

Redraw.java
public class Redraw extends AnimationScheduler {
private AnimationScheduler.AnimationHandle hAnimScheduler;
public Redraw() {
hAnimScheduler = new AnimationScheduler.AnimationHandle() {
@Override
public void cancel() {
// TODO Auto-generated method stub
}
};
}
public AnimationScheduler.AnimationHandle requestAnimationFrame(AnimationScheduler.AnimationCallback cb, Element e) {

                // cb.execute() works here but only once, not getting scheduled regularly
                //

return hAnimScheduler;
}
}

I do not have much programming experience with java and I am not sure whether this is the correct way to use requestAnimationFrame().
The callback doesn't seem to be scheduled,
I really appreciate any advice in this regard.

-br
Arun

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/-y4hkIDt5BUJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment