Search code examples
openglglslvertex-shaderquartz-composerglsles

glsl shader in Quartz Composer


I was trying to make this shader working in Quartz Composer

When I copy this shader's code to Fragment Shader in the GLSL Shader patch, error: input of fragment shader 'surfacePosition' not written by vertex shader

So what do I need to fill in the vertex shader instead of the default?


Solution

  • Quartz Composer's default vertex shader uses gl_TexCoord[0] to pass the texture coordinate from the vertex shader to the fragment shader.

    So, in the fragment shader, you could remove varying vec2 surfacePosition;, and in line 16, replace surfacePosition with gl_TexCoord[0].xy-0.5.