var canvas = document.createElement("canvas");
document.body.appendChild(canvas);
canvas.width = 300;
canvas.height = 300;
var canvas2 = document.createElement("canvas");
document.body.appendChild(canvas2);
canvas2.width = 300;
canvas2.height = 300;
var gl = canvas.getContext("experimental-webgl");
var gl2 = canvas2.getContext("experimental-webgl");
gl.clearColor(1, 0, 0, 1);
gl2.clearColor(0, 1, 0, 1);
gl.clear(gl.COLOR_BUFFER_BIT);
gl2.clear(gl2.COLOR_BUFFER_BIT);
On Fri, 1 Feb 2013 19:39:47 -0800 (PST)
Jonathan Hardie <jonatha...@gmail.com> wrote:
> * there is `canvas.getContext2d`, should there also be
> `canvas.getContext3d` which either gets "experimental-webgl" or
> "webgl" and returns `js.html.webgl.RenderingContext`? I found
> `RenderingContext` difficult to find at first since I had to look for
> it in the webgl package, while `CanvasRenderingContext2D` is in the
> html package. Just using `canvas.getContext("experimental-webgl")`
> returns a `CanvasRenderingContext` type, which would need casting
> into a variable of type `webgl.RenderingContext`.
canvas.getContextWebGL is now on SVN.
> * WebGL RenderingContext has a bunch of inline static vars, that
> *look* like constants because of their uppercase naming, but are
> actually just regular instance variables.
They actually are constants. WebGL does let you access them as static
properties on the RenderingContext class or as readonly instance
variables. Haxe can't support both (not allowed to have a static named
the same as a member) and using the static has the benefit of being
inlinable.
I'd recommend doing something like this:
import js.html.webgl.RenderingContext in GL;
// ...
ctx.clear(GL.COLOR_BUFFER_BIT);
Maybe we should just rename RenderingContext to GL?
> * `Console.log` and other console functions don't currently accept
> *any* arguments. This one is tricky I know, since `console.log` can
> take an arguments list of arbitrary length.
Fixed on SVN, thanks!
> I'd really like to be able to contribute to this project in the
> future, as I think it's a really important one for Haxe to get right,
> but I'm not sure of exactly the best way to proceed while the externs
> are dynamically generated. Is there a way to patch these types of
> things into the generator system being used so that manual changes
> are respected when the externs are regenerated?
Send patches to the Python generator at
https://github.com/aduros/Browser.hx. Any manual changes to the
generated Haxe will be overwritten.
Bruno
I guess I will have to try my hand at some python if I have anything to contribute :-P
I'll be sure to note anything else I notice as I continue my exploration.
@Nicolas: Already I'm longing for GLSL support from HxSL ;-)
Cheers,