Does the FF nightly work for you? It doesn't for me at the moment, at least not with those samples (link to my post below, in case this discussion gets big: http://news.ycombinator.com/item?id=831988).
Any tips appreciated. I'll have a few hours free this afternoon, so I may muck around with this!
This is great, a single standard being implemented in WebKit AND Firefox. Someone will probably have to write a plugin for IE though, since it's HIGHLY doubtful Microsoft would cooperate.
We've got just about everyone EXCEPT the major browser vendor working on cool, useful, forward-thinking innovations, and standardizing on them with relative ease. Yet all of this innovation is so sorely limited without Microsoft's contribution (to IE).
Normally I just nod my head and move on, but the future doesn't look any brighter for IE. Hopefully Microsoft's halfhearted interest in HTML5 will improve.
But then again, MS could drop WebKit into IE9, and we'd still be stuck, unless Microsoft shoves IE9 down the Automatic Update pipeline as a required update. Which they should, IMHO. Progress is worth some pain.
We've got just about everyone EXCEPT the major browser vendor working on cool, useful, forward-thinking innovations, and standardizing on them with relative ease. Yet all of this innovation is so sorely limited without Microsoft's contribution (to IE).
Microsoft's ActiveX has been around for a long time. And I remember a little something called VRML that was supported by the major browsers of the time.
I'm looking more for something community-or-compatibility driven. The web community pushes for certain things; when everyone except IE gets on board, Microsoft should strive to pursue those standards.
Poor word choice on my part: Microsoft has innovated before, yes. They're innovating now in various spaces. But they're dragging their feet in areas that could really boost the web as a platform, and that slows progress.
1994, and SGI IRIX already shipped with browser plugin for 3D and 3d content creator. even the lowly 8bit indy could handle it. VRML at it's best (if it had any best...)
The 5.3 or 6.2 version of Irix (do not recall which one, the one that shipped with netscape 2.0) also had all the admin apps written in html+javascript, but completely merged with the OS look n feel. you simply couldn't tell.
I just got back, and I'm needing to look at the google cache of almost every mozilla forum page; I haven't gotten through to their forums a single time yet.
Their 'search moz code' thingy still works -- searching it for WebGL turns up lots ... I mean LOTS ... of code. But even though I've found a list of enums for contexts, etc, I still haven't quite found where the mapping is, or where the actual base getcontext() function is located.
I have powerful procrastination forces pushing me, though.
Try using "for in" to iterate through the returned canvas's properties. You'll get all the methods of the canvas. So far this sort of stuff works (OSX Leopard): gl.clearColor(0,0,0,0);
gl.clear(gl.COLOR_BUFFER_BIT);
I'll edit this to update on problems as they come. For people trying to run the existing webgl samples (using something like utils3d.js) that are out there with the nightly ff build:
1) canvasElement.getContext("moz-webgl"), not "webkitwhatever"
(Conflicts w/presentation slides pdf on the khronos site, which says "3D" with a capital D)
That's how far I've gotten so far.
Much more perplexing to me is a case where their code seems (I want to stress, seems!; maybe it's staring me in the face and I just don't get how they changed it) to break an opengl function: glBindBuffer. http://www.opengl.org/sdk/docs/man/xhtml/glBindBuffer.xml
The specs say, call glBindBuffer with (arg, arg2), and arg2 will be an unsigned int which refers to a buffer.
The reference above says, calling it with an arg2 of 0 and it'll reset. The webkit examples use it this way. But, their implementation of the wrapped BindBuffer method doesn't like this; if you pass in 0, it gives you an error that suggests you mean null. Pass in null, and there's an uncaught exception and an error in glBufferData, telling you that, surprise, you want an Unsigned Short.
The typing of the args won't let you pass in a zero, and the typing on the constructor for the cast is what kills it if you pass in a javascript null (it wants an integer).
And if you try to instantiate a WebGLBuffer instance with javascript -- whose constructor expects an int -- it won't let you.
nbuf = new WebGLBuffer(0);
-> [Exception... "Cannot convert WrappedNative to function"...
You could try calling glGet... on the buffer early on, caching the default value it returns to you and then using that to invoke bindBuffer (just to be sure you're not calling it with something it shouldn't understand) but this doesn't wrap opengl directly enough; it's just whatever you see implemented here (http://mxr.mozilla.org/mozilla-central/source/content/canvas...). Some functions, like bindbuffer, are implemented. The others are named very differently, and look like this:
17 comments
[ 123 ms ] story [ 1858 ms ] threadvideo: http://www.youtube.com/watch?v=2rpKpj6ZO9w&hd=1
Any tips appreciated. I'll have a few hours free this afternoon, so I may muck around with this!
We've got just about everyone EXCEPT the major browser vendor working on cool, useful, forward-thinking innovations, and standardizing on them with relative ease. Yet all of this innovation is so sorely limited without Microsoft's contribution (to IE).
Normally I just nod my head and move on, but the future doesn't look any brighter for IE. Hopefully Microsoft's halfhearted interest in HTML5 will improve.
But then again, MS could drop WebKit into IE9, and we'd still be stuck, unless Microsoft shoves IE9 down the Automatic Update pipeline as a required update. Which they should, IMHO. Progress is worth some pain.
Microsoft's ActiveX has been around for a long time. And I remember a little something called VRML that was supported by the major browsers of the time.
Poor word choice on my part: Microsoft has innovated before, yes. They're innovating now in various spaces. But they're dragging their feet in areas that could really boost the web as a platform, and that slows progress.
Them not innovating is actually a smart business decision from their angle.
The 5.3 or 6.2 version of Irix (do not recall which one, the one that shipped with netscape 2.0) also had all the admin apps written in html+javascript, but completely merged with the OS look n feel. you simply couldn't tell.
Not a single one of the examples from http://trac.webkit.org/changeset/48330 are loading for me.
They all error with:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIDOMHTMLCanvasElement.getContext]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://trac.webkit.org/export/48330/trunk/WebCore/manual-tes... :: initWebGL :: line 19" data: no]
etc.
Anyone on here get it working?
I tried to change it to all the values I found on developer's blogs and even in the Painting the Web Oreily book.
"3d", "-moz-webgl2.0", "webgl2.0", "webgl", "gl", "moz-gles11"
All got me the same NS_ERROR_ILLEGAL_VALUE
// IID for the nsIRenderingContext interface
// 37762dd8-8df0-48cd-a5d6-24573ffdb5b6
#define NS_IRENDERING_CONTEXT_IID \
{ 0x37762dd8, 0x8df0, 0x48cd, \
which does not mean anything to me.other example, that also do not work with minefield: http://www.c3dl.org/
Official word: https://wiki.mozilla.org/Canvas:3D
I just got back, and I'm needing to look at the google cache of almost every mozilla forum page; I haven't gotten through to their forums a single time yet.
Their 'search moz code' thingy still works -- searching it for WebGL turns up lots ... I mean LOTS ... of code. But even though I've found a list of enums for contexts, etc, I still haven't quite found where the mapping is, or where the actual base getcontext() function is located.
I have powerful procrastination forces pushing me, though.
Okay, the relevant/revelatory code can be seen at:
http://mxr.mozilla.org/mozilla-central/source/content/html/c...
Here's the string being constructed in the getContext method, after some checking:
Where ctxId is, say, "2d".I'd assume it's some kind of resource naming convention or somesuch ... but, anyway, searching for strings "@mozilla.org/" and canvas and gl ...
You get nsLayoutModule.cpp
bingo! "moz-webgl" WORKS.The first example I tried fails:
:(But, anyway, it's a start.
I'll edit this to update on problems as they come. For people trying to run the existing webgl samples (using something like utils3d.js) that are out there with the nightly ff build:
(Conflicts w/presentation slides pdf on the khronos site, which says "3D" with a capital D) That's how far I've gotten so far. Much more perplexing to me is a case where their code seems (I want to stress, seems!; maybe it's staring me in the face and I just don't get how they changed it) to break an opengl function: glBindBuffer. http://www.opengl.org/sdk/docs/man/xhtml/glBindBuffer.xmlThe specs say, call glBindBuffer with (arg, arg2), and arg2 will be an unsigned int which refers to a buffer.
The reference above says, calling it with an arg2 of 0 and it'll reset. The webkit examples use it this way. But, their implementation of the wrapped BindBuffer method doesn't like this; if you pass in 0, it gives you an error that suggests you mean null. Pass in null, and there's an uncaught exception and an error in glBufferData, telling you that, surprise, you want an Unsigned Short.
In their code,
The typing of the args won't let you pass in a zero, and the typing on the constructor for the cast is what kills it if you pass in a javascript null (it wants an integer).And if you try to instantiate a WebGLBuffer instance with javascript -- whose constructor expects an int -- it won't let you.
You could try calling glGet... on the buffer early on, caching the default value it returns to you and then using that to invoke bindBuffer (just to be sure you're not calling it with something it shouldn't understand) but this doesn't wrap opengl directly enough; it's just whatever you see implemented here (http://mxr.mozilla.org/mozilla-central/source/content/canvas...). Some functions, like bindbuffer, are implemented. The others are named very differently, and look like this: Heh. Well ... I guess I'll see if I can find an example that never needs to reset the buffer binding. :P