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

GLSL - OpenGL Shader Language

Definitely check out ShaderToy to see many other examples: https://www.shadertoy.com/




Ah, thanks! I was trying to copy-paste some examples and they didn't quite work -- it looks like ShaderToy exposes a mainImage(out vec4, in vec2) function with a different signature than the simulation-Sphere site wants. For example there's no main() method in here [0] and I wasn't sure how to translate that to the sphere's expected inputs.

[0] https://www.shadertoy.com/view/Ms2SDc


Yeah, looks like there's a couple of differences. If you look at the top left there are a few examples that are shadertoy examples. Example 5 (Smiley face) shows some differences:

* the void main() declaration difference

* the inclusion of iTime vs time

* gl_FragColor vs fragcolor

Also, the demo adds:

uniform float time;

varying vec2 vUv;

varying vec3 vNormal;

I think those are the biggest differences.


Yeah, you will need to adapt the code a bit: https://gist.github.com/b0o/ac939eb1608f949765ac842fe28f53b9


Nice!




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: