[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Please review WebGL multiple render target extension proposal



I'm mixed on using indices instead of constants. One minor advantage to constants is given a value you can convert it back into a meaningful string. If I just have '4' is that the 4th texture? the 4th drawbuffer? the 4th attachment?  With constants that's clear.

0x84C4 is TEXTURE4
0x882A is DRAWBUFFER4
0x8CE4 is COLOR_ATTACHMENT4

Which helps with auto generated logging code. You can write wrappers that look at the IDL and make GLenums get logged by calling something like

var glEnumToString = function(gl, value) {
  for (var p in gl) {
    if (gl[p] == value) {
      return p;
    }
  }
  return "0x" + value.toString(16);
};

Where as if they are just indices then you'd have to write different code for each function.



On Wed, Oct 17, 2012 at 9:31 AM, Benoit Jacob <bjacob@mozilla.com> wrote:

Instead of introduding new families of 16 symbolic constants, couldn't
we switch to an index-based API?

I realize that the current proposal was motivated by similarity to the
existing OpenGL interface, but since the symbolic constants have
adjacent values, it should be straightforward to map one API onto the
other one, for the uses of e.g. automated porting of OpenGL applications
to WebGL.

Benoit


On 12-10-16 09:51 PM, Kenneth Russell wrote:
> Please review an extension proposal adding multiple render target
> functionality to WebGL:
>
> http://www.khronos.org/registry/webgl/extensions/proposals/WEBGL_multiple_render_targets/
>
> It mirrors a proposed extension for ANGLE which adds this
> functionality to OpenGL ES 2.0:
>
> https://angleproject.googlecode.com/svn/trunk/extensions/ANGLE_multiple_render_targets.txt
>
> Please provide your feedback on both.
>
> Apologies for how long it took to produce these extensions. They
> couldn't be drafted until OpenGL ES 3.0 was released, because in order
> to avoid compatibility issues in the future, it was necessary to
> derive their contents from the ES 3.0 specification. The draft ANGLE
> extension modifies the same areas of the OpenGL ES 2.0 specification
> modified by the GL_NV_fbo_color_attachments and GL_NV_draw_buffers
> extensions, but draws the majority of its text and semantics from the
> ES 3.0 spec.
>
> -Ken
>
> -----------------------------------------------------------
> You are currently subscribed to public_webgl@khronos.org.
> To unsubscribe, send an email to majordomo@khronos.org with
> the following command in the body of your email:
> unsubscribe public_webgl
> -----------------------------------------------------------
>


-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------