Skip to content

Commit

Permalink
add main() to the shaders from shadertoy.com.
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-budig committed Jul 29, 2015
1 parent 6f6efd3 commit 90f7bd6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion getshader.py
Expand Up @@ -38,6 +38,18 @@
uniform float iSampleRate; // sound sample rate (i.e., 44100)
\n"""

# see https://www.shadertoy.com/js/effect.js?v=8

shadermain = """\n
void main (void)
{
vec4 color = vec4 (0.0, 0.0, 0.0, 1.0);
mainImage (color, gl_FragCoord.xy);
color.w = 1.0;
gl_FragColor = color;
}
"""

def get_shader (id):
url = 'https://www.shadertoy.com/shadertoy'
headers = { 'Referer' : 'https://www.shadertoy.com/' }
Expand All @@ -64,7 +76,7 @@ def get_shader (id):
for p in s["renderpass"]:
code = (p["code"])
return name, code, s["info"]


if __name__ == '__main__':
if len (sys.argv) < 2:
Expand Down Expand Up @@ -93,6 +105,7 @@ def get_shader (id):
f.write (shaderinfo % info)
f.write (shaderdecls)
f.write (code)
f.write (shadermain)
f.close ()
print ("wrote shader to \"%s\"" % fname, file=sys.stderr)

0 comments on commit 90f7bd6

Please sign in to comment.