GLSL shaders Converting for use in Quartz Composer

zqpm1qaz's picture

Hi there! I follow this tutorial to make GLSL shader for Qc. most of GLSL code on that page work great. http://destroythingsbeautiful.com/2013/01/10/converting-glsl-shaders-for...

when I try put this GLSL shader to Quartz Composer GLSL shader http://glslsandbox.com/e#24624.0 I get "ERROR:input of fragment shader 'surfacePosition' not written by vertex shader" under Fragment window.and The GlSL shader dont' work. Anyone know how to fixt it let this GLSL shader work in qc,I not good at GLSL coding.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

dust's picture
Re: GLSL shaders Converting for use in Quartz Composer

i find shadertoy.com to be a good resource to learn shaders. you can tweak them on the website and easily copy the fragment shader to quartz composer with basically a few global uniform changes. here is a couple examples.

zqpm1qaz's picture
Re: GLSL shaders Converting for use in Quartz Composer

Thanks!There are many amazing shader code. but It still too complex..I have no idea to converting it for quartz composer. I check your example. you add some code to the original shader make it work in QC. maybe i need to study everything form beginning. or any simple way or rule to converting it?

zqpm1qaz's picture
Re: GLSL shaders Converting for use in Quartz Composer

I fixt it.Quartz Composer's default vertex shader uses gl_TexCoord[0] to pass the texture coordinate from the vertex shader to the fragment shader.in the fragment shader, you could remove varying vec2 surfacePosition;, and in replace surfacePosition with gl_TexCoord[0].xy