Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no main().. #4

Closed
robclark opened this issue Jul 29, 2015 · 4 comments
Closed

no main().. #4

robclark opened this issue Jul 29, 2015 · 4 comments

Comments

@robclark
Copy link

I think you need to append something along the lines of:

void main() { mainImage(gl_FragColor, gl_FragCoord.xy); }

to the end of the shader.. I guess that should probably be done in getshader.py

@simon-budig
Copy link
Owner

yeah, seems something has changed on shadertoy.com. Need to investigate this.

@robclark
Copy link
Author

fwiw, this seems to do the trick:


diff --git a/getshader.py b/getshader.py
index 5123300..053bd91 100755
--- a/getshader.py
+++ b/getshader.py
@@ -38,6 +38,10 @@ uniform vec4 iDate; // (year, month, day, time in secs)
uniform float iSampleRate; // sound sample rate (i.e., 44100)
\n"""

+shaderfooter = """
+void main() { mainImage(gl_FragColor, gl_FragCoord.xy); }
+\n"""
+
def get_shader (id):
url = 'https://www.shadertoy.com/shadertoy'
headers = { 'Referer' : 'https://www.shadertoy.com/' }
@@ -93,6 +97,7 @@ if name == 'main':
f.write (shaderinfo % info)
f.write (shaderdecls)
f.write (code)

  •  f.write (shaderfooter)
    
    f.close ()
    print ("wrote shader to "%s"" % fname, file=sys.stderr)

not sure if there is a better way to pick the sampler types.. but anyways, this is pretty cool since I'd been wanting to test freedreno against some of the shadertoy shaders, but with firefox I just get crashes in some unrelated cairo code ;-)

@simon-budig
Copy link
Owner

I have tracked down main() used on shadertoy.com. It additionally ensures that the alpha channel is opaque.

fixed in commit 90f7bd6

@robclark
Copy link
Author

cool, thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants