0

I'm trying to make kind of polar clock in Quartz Composer with GLSL Shaders. The problem is i've no idea of this programming language. However i've been searching and found this code as good start:

Vertex Shader:

#version 120    
void main()
{
  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;       
  gl_TexCoord[0] = gl_MultiTexCoord0;
}

Fragment Shader:

#version 120
uniform sampler2D tex0;
uniform float border; // 0.01
uniform float circle_radius; // 0.5
uniform vec4 circle_color; // vec4(1.0, 1.0, 1.0, 1.0)
uniform vec2 circle_center; // vec2(0.5, 0.5)
void main (void)
{
  vec2 uv = gl_TexCoord[0].xy;

  vec4 bkg_color = texture2D(tex0,uv * vec2(1.0, -1.0));

  // Offset uv with the center of the circle.
  uv -= circle_center;

  float dist =  sqrt(dot(uv, uv));
  if ( (dist > (circle_radius+border)) || (dist < (circle_radius-border)) )
    gl_FragColor = bkg_color;
  else 
    gl_FragColor = circle_color;    
}

Now i'd like to know where to say to this code that it will be drawn by degrees depending of the variable on the input.

Thank You in advance

Dekrab
  • 1
  • From my experience, I can only recommend a wraparound about the basics of GLSL before trying this and that with them, not knowing the fundamental things; have a look at http://www.arcsynthesis.org/gltut ;o – Ray Nov 21 '14 at 13:32
  • You are right, the best option is begin at the beginning. Thank You! – Dekrab Nov 21 '14 at 16:11

0 Answers0