Live data from Hacker News

SwissGL: Swiss Army Knife for WebGL2

github.com

1–10 of 19 posts

Re: SwissGL: Swiss Army Knife for WebGL2

#3

nice, I do not even know WebGL2 exists, and thought WebGPU is going to replace WebGL instead. WebGL2 looks well supported and very cool to use right now.

The biggest difference I spot between the two is that WebGL2 uses OpenGL ES 3 and WebGL uses OpenGL ES 2, but really other than supporting by default things that required extensions in WebGL I don't see much of an improvement. Also, it was released in Firefox in 2017 meaning it has been here for a long time already [0].

Interestingly enough projects such as Godot seem to until recently give preference to other APIs such as Vulkan and OpenGL ES 2 over OpenGL ES 3, not sure why though [1]. The biggest culprits seem to be mobile and Safari not implementing WebGL 2 until last year (what the hell Apple) [2].

I should note I'm not really familiar with neither APIs and only have a high-level understanding of WebGL.

[0]: https://hacks.mozilla.org/2017/01/webgl-2-lands-in-firefox/

[1]: https://godotengine.org/article/abandoning-gles3-vulkan-and-...

[2]: https://godotengine.org/article/about-godot4-vulkan-gles3-an...

Re: SwissGL: Swiss Army Knife for WebGL2

#4

nice, I do not even know WebGL2 exists, and thought WebGPU is going to replace WebGL instead. WebGL2 looks well supported and very cool to use right now.

The biggest difference I spot between the two is that WebGL2 uses OpenGL ES 3 and WebGL uses OpenGL ES 2, but really other than supporting by default things that required extensions in WebGL I don't see much of an improvement. Also, it was released in Firefox in 2017 meaning it has been here for a long time already [0]. Interestingly enough projects such as Godot seem to until recently give preference to other APIs s…

WebGL 2 has a lot of stuff which is very nice if you are writing WebGL code, and some things that were just impossible in WebGL 1 even with extensions: https://webgl2fundamentals.org/webgl/lessons/webgl2-whats-ne...

There is very little reason to restrict yourself to WebGL 1 anymore, but many existing projects are still on WebGL 1 because Safari didn't support WebGL 2 when they were written.

WebGL 2 is going to be the best option for a long time. While WebGPU is in progress it will be many, many years before it is supported anywhere near as widely as WebGL 2.

Re: SwissGL: Swiss Army Knife for WebGL2

#5

nice, I do not even know WebGL2 exists, and thought WebGPU is going to replace WebGL instead. WebGL2 looks well supported and very cool to use right now.

The biggest difference I spot between the two is that WebGL2 uses OpenGL ES 3 and WebGL uses OpenGL ES 2, but really other than supporting by default things that required extensions in WebGL I don't see much of an improvement. Also, it was released in Firefox in 2017 meaning it has been here for a long time already [0]. Interestingly enough projects such as Godot seem to until recently give preference to other APIs s…

It was also supposed to support GL ES compute shaders, developed by Intel, which Google refused to implement in name of WebGPU compute.

So here we are without WebGPU being stable and without WebGL compute.

Re: SwissGL: Swiss Army Knife for WebGL2

#7
Author here. SwissGL is an experiment in minimal API design. I needed something that would simplify making things like https://znah.net/hexells or https://znah.net/lenia

I'm planning to switch to WebGPU once it's widely supported. I also think there's a chance for SwissGL.c, SwissGL.py and SwissGL.zig

Re: SwissGL: Swiss Army Knife for WebGL2

#8

nice, I do not even know WebGL2 exists, and thought WebGPU is going to replace WebGL instead. WebGL2 looks well supported and very cool to use right now.

The biggest difference I spot between the two is that WebGL2 uses OpenGL ES 3 and WebGL uses OpenGL ES 2, but really other than supporting by default things that required extensions in WebGL I don't see much of an improvement. Also, it was released in Firefox in 2017 meaning it has been here for a long time already [0]. Interestingly enough projects such as Godot seem to until recently give preference to other APIs s…

Actually I believe apple and windows use a library to convert gles3/webgl2 to metal and dx.

Re: SwissGL: Swiss Army Knife for WebGL2

#9
post #7

Author here. SwissGL is an experiment in minimal API design. I needed something that would simplify making things like https://znah.net/hexells or https://znah.net/lenia I'm planning to switch to WebGPU once it's widely supported. I also think there's a chance for SwissGL.c, SwissGL.py and SwissGL.zig

This seems like a cool project. Is there a specific reason why you decided that allocating resources like textures should use the same function as performing rendering operations? It seems like it unnecessarily complicates reading the code and wouldn't be much worse if (for example) you did glsl.tex() or glsl.vbuf() etc when allocating resources and used glsl() for the rest. I was very confused when reading that part initially.

Re: SwissGL: Swiss Army Knife for WebGL2

#10
post #7

Author here. SwissGL is an experiment in minimal API design. I needed something that would simplify making things like https://znah.net/hexells or https://znah.net/lenia I'm planning to switch to WebGPU once it's widely supported. I also think there's a chance for SwissGL.c, SwissGL.py and SwissGL.zig

This seems like a cool project. Is there a specific reason why you decided that allocating resources like textures should use the same function as performing rendering operations? It seems like it unnecessarily complicates reading the code and wouldn't be much worse if (for example) you did glsl.tex() or glsl.vbuf() etc when allocating resources and used glsl() for the rest. I was very confused when reading that part…

I wanted to avoid (in some cases) a separate initialization phase and unify resource allocation with rendering (because requirements may change and require reallocation). Take GameOfLife example (https://github.com/google/swissgl/blob/main/demo/GameOfLife....). It only has 'frame()' function which transparently resizes textures when needed.
Post reply on HN