Stream: ideas

Topic: OpenGL, GLSL, and shadertoy.com


view this post on Zulip jan kili (Jun 13 2022 at 13:23):

I'm loving Inigo Quilez's videos on painting with maths: https://youtu.be/BFld4EBO2RE

Is anyone here familiar with OpenGL, GLSL, or shadertoy.com? I know basically nothing about this ecosystem, but I'd love to manipulate 3D environments in Roc :)

I'm hoping that a set of GL platforms is possible (for native & web), to provide a similar API as shadertoy.com and enable porting those posts/scripts/creations to Roc... or at least a higher-level API that enables manipulation of the constants and parameters involved.

view this post on Zulip jan kili (Jun 13 2022 at 13:23):

GLSL: https://www.khronos.org/opengl/wiki/OpenGL_Shading_Language

view this post on Zulip Anton (Jun 13 2022 at 13:53):

We use wgsl, a new shading language for WebGPU in the editor and also in the GUI example. So we already have a big part of the pipeline on the rust side :)

view this post on Zulip jan kili (Jun 13 2022 at 16:54):

@Anton Yay! Where would you recommend I start, with my goal being that landscape above? Modifying the GUI example?

view this post on Zulip Anton (Jun 13 2022 at 17:28):

I can't see the source of the landscape (from the link on youtube) on shadertoy, possibly because webGL doesn't work on my browser, but I would start from this wgpu example. I'd start a new empty rust project (cargo init) that can run that example, so leaving out roc for now. If the landscape consists of a single shader, I'd modify the wgpu example so that it only uses the terrain shader without the water one. Once that is set up you can start translating the GLSL landscape shader to WGSL. wgpu used to use GLSL so you can see how to translate by going back to earlier versions. You'll then have to change water/main.rs to generate the appropriate inputs for the shader. Once that works you can connect it to roc similarly to the GUI example, just ignoring what comes from roc for now. Once that's all done we can discuss altering the shader inputs from roc and if you'd like, look into actually generating the shaders from roc and translating them to wgsl.


Last updated: Jun 16 2026 at 16:19 UTC