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

Re: [Public WebGL] Explicit unboxing for object identifiers



On Sun, Jan 8, 2012 at 9:11 AM, Rehno Lindeque <rehno.lindeque@gmail.com> wrote:
> On Sun, Jan 8, 2012 at 8:37 AM, Benoit Jacob <bjacob@mozilla.com> wrote:
>> What is you use case for comparing uniform locations? Why can't you implement it on your side, maybe with a shim/wrapper around webgl.getUniformLocation?
>
> I'm implementing a library called glQuery which is basically
> stratified into three layers. The bottom layer is supposed to be a
> very thin layer over WebGL where you can pass any existing webgl
> object directly to glQuery functions and it'll all just work. The idea
> is that if you have an existing webgl app you can just drop in glQuery
> and start using it with existing objects.
>
> I don't actually strictly need to take uniform locations in my api but
> it would be a nice to have if the user app fails to store name
> identifiers along with uniform locations. (There's some very
> rough/incomplete API documentation as to what I have in mind here:
> https://github.com/glQuery/glQuery/wiki/API)

Actually, I apologize - now that I look at my API again I'm reminded
that I made a decision to not support uniform location objects earlier
on... Perhaps others need this but it looks like I don't actually
require it right now (although I might for other types of object
identifiers in the future). My primary use case was using WebGL
objects as keys for dictionaries.

I suppose that if it is guaranteed that object identifiers will always
reference the same object I could get away with extending those
objects with new attributes.

E.g. instead of

    var dict = {};
    dict[uniformLocation] = data;

one could do

    uniformLocation.data = data;

...and the `data` attribute would remain even when you request the
uniform location a second time?

-----------------------------------------------------------
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
-----------------------------------------------------------