Thursday, 23 February 2012

HTML5 Canvas 3d?

Introduction
A few people seem a little confused by the HTML5 canvas tag and if it's possible to create 3d elements inside of it, the main reason for this is the getContext("2d") method with the parameter of 2d and logically people think there must be a 3d parameter too.

Is canvas 3d then?
Unfortunately there is only a 2d parameter for the getContext() method and no 3d option but in the future they are planning on adding the 3d parameter.

So I can't use 3d in canvas? :(
Despite what I've stated above it is still possible to have 3d effects using HTML5 canvas but it's just not been standardised by anyone yet, this hasn't stopped browsers from implementing their own methods of 3d.  The main method of doing this seems to be by using WebGL and there are a few HTML5 3d engines / frameworks out already based on this.

Unfortunately I don't really understand enough about the topic to go into any real depth but there are plenty of great examples if you Google around for them.

Should you use it?
Personally I wouldn't build anything that relied on it as only a few browser support it and as it's not standardised so in a few years when a standard does come out parts of what you've made may not work any more.  Personally I plan on building some cool web apps with it in the near future but mainly for the 'cool' factor.

WebGL security
I feel I should mention a bit about security in relation to WebGL in that it has some flaws, can't say I full understand these yet myself either but I've put some links below about them.
Further reading

No comments:

Post a Comment