For the last few weeks I've been trying to create a GWT based game (which I will go into more detail about later), that included a HTML 5 Canvas element. I had been programming in Eclipse with the GWT plugin, and thankfully that included support for Eclipse's excellent debugging features. The GWT plugin even has a mini browser built in (seemingly based on Chrome) that makes quick testing a breeze.
Well, I wanted to include a fancy Canvas timer widget in my project. Unfortunately, GWT doesn't have a Canvas element widget built in (yet), so I used this. I programmed up my fancy timer and added some preliminary eye candy effects, and tested everything in the GWT browser. Everything worked. Life was good.
Then, I decided I would try and upload my project to AppEngine, Google's web app hosting service. Waited for a few minutes for the project to compile, checked the link it gave me, and was shocked to see that the timer widget I worked so hard on was not working at all in Firefox! CPU usage spiked after a second or two, and things went downhill from there...
Long story short, after a good 5 hours of searching, recoding, recompiling, and alcohol, I finally found my problem: I didn't tell the Canvas context that I was starting a new path. One simple ctx.beginPath(); and I was good to go.
Why did I post this? Because nothing in my Google searches brought up that this could happen, and if it did, I would have been done in a good 5 minutes! So, dear Google searcher from the future, if you are having an issue where your Canvas animation works in the GWT browser, and in Chrome, but ramps up the CPU to the point of freezing anywhere else, you're missing a beginPath() call.
Oh how I wish Google indexed the future....
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment