2 // Vertex shader for drawing the Mandelbrot set
4 // Authors: Dave Baldwin, Steve Koren, Randi Rost
5 // based on a shader by Michael Rivero
7 // Copyright (c) 2002-2005: 3Dlabs, Inc.
9 // See 3Dlabs-License.txt for license information
12 uniform vec3 LightPosition;
13 uniform float SpecularContribution;
14 uniform float DiffuseContribution;
15 uniform float Shininess;
17 varying float LightIntensity;
18 varying vec3 Position;
22 vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Vertex);
23 vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal);
24 vec3 lightVec = normalize(LightPosition - ecPosition);
25 vec3 reflectVec = reflect(-lightVec, tnorm);
26 vec3 viewVec = normalize(-ecPosition);
27 float spec = max(dot(reflectVec, viewVec), 0.0);
28 spec = pow(spec, Shininess);
29 LightIntensity = DiffuseContribution *
30 max(dot(lightVec, tnorm), 0.0) +
31 SpecularContribution * spec;
32 Position = vec3(gl_MultiTexCoord0 - 0.5) * 5.0;
33 gl_Position = ftransform();