Requesting API additions

I was wondering who was deciding what was going into the API, and how best I could harass them :slight_smile:
While using WebGL there have been a few overloads that would be nice to have for certain methods, mainly things that would enable the same semantics the native GL API has on methods that were changed when brought to Javascript.

Specifically, right now I’m using readPixels, and this returns a new pixel array each call. The native API is much smarter about this and just takes a destination pointer, allowing you to pass your own buffer. I can see how having readPixels return an array is simpler, however if you are doing full-screen reads (or even moderately large ones) each frame you end up creating many mb of garbage each frame.
It would be nice if the call could take an array as an argument - maybe if you omit it you still get the new array back (just like today), but if it’s passed in it’ll use that.
var pixels = gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE);
var myBuffer = new WebGLUnsignedByteArray(width * height * 4);
gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, myBuffer);
Then you can be smart and keep myBuffer around, preventing tons of memory churn.

Use FBOs instead of readPixels.