3 ms·
Author here. SwissGL is an experiment in minimal API design. I needed something that would simplify making things like https://znah.net/hexells https://znah.net
by znah 4y ago
Author here. SwissGL is an experiment in minimal API design. I needed something that would simplify making things like https://znah.net/hexells https://znah.net/hexells or https://znah.net/lenia 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
- kevingadd 4y agoThis 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.
- znah 4y agoI 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.js https://github.com/google/swissgl/blob/main/demo/GameOfLife....). It only has 'frame()' function which transparently resizes textures when needed.
- shaneos 4y agoThe example in the README seems to be dividing “undefined” by 1000. Am I misunderstanding something, does that code truly generate the output shown somehow?
- znah 4y agoFixed, thanks for pointing! Undefined is only passed at the first frame, other frames receive current time in ms, according to requestAnimationFrame docs