Skip to content

Comment on Why Canvas is not an obvious choice for web games

Comments

I think he is comparing apples to oranges here. Using HTMl as the "rendering device" works on a different (higher) level of abstraction. The additional layer of abstraction in HTML has already solved the complexity of doing efficient partial redraws based on changes to a subset of a scene graph. This isn't something that the canvas API was meant to handle. If one were to use a scene graph (or display list) abstraction on top of canvas, it would shield the application developer from this complexity just as well as the HTML does now. However, the HTML abstraction, although more general, is implemented in native code while a canvas based scene-graph would need to go through java-script, so it is at a disadvantage as to how far it can be optimized. Basically, what he needs is SVG. :-)

>Basically, what he needs is SVG. :-)

Yes. It's incredibly frustrating that we can't rely on embedding SVG in HTML. (Last I looked--about 2.5 years ago, admittedly--only Firefox could do it, and only with XHTML.)

Once IE 9 comes out, the majority of browsers will support inline SVG. Only Opera is currently an unknown:

http://caniuse.com/#cats=SVG,Summary&statuses=rec,pr,cr,...

Thanks!

You should check out http://raphaeljs.com/ , which basically unifies the SVG API in a cross-browser way. In IE, it translates everything to VML on the fly. You need to transcode your SVG to Raphael's JSON-based format, but it's not hard to do.

Thanks, I'll take a look next time I need it.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.