Results 1 to 2 of 2

Thread: Requesting API additions

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    1

    Requesting API additions

    I was wondering who was deciding what was going into the API, and how best I could harass them
    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.
    e.g.:
    var pixels = gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE);
    or
    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.

  2. #2
    Junior Member
    Join Date
    Dec 2009
    Posts
    8

    Re: Requesting API additions

    Use FBOs instead of readPixels.

Similar Threads

  1. Relation between OpenVG API and VGU API
    By chloe.koh in forum OpenVG and VGU
    Replies: 3
    Last Post: 07-12-2010, 10:19 PM
  2. about OpenGL ES API !
    By jier-wang in forum OpenGL ES general technical discussions
    Replies: 0
    Last Post: 02-17-2004, 05:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •