Hacker News new | past | comments | ask | show | jobs | submit login

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.


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.


The example in the README seems to be dividing “undefined” by 1000. Am I misunderstanding something, does that code truly generate the output shown somehow?


Fixed, thanks for pointing! Undefined is only passed at the first frame, other frames receive current time in ms, according to requestAnimationFrame docs




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: