13.07.2015 Views

Rendering, OpenGL, and Lighting - Caltech

Rendering, OpenGL, and Lighting - Caltech

Rendering, OpenGL, and Lighting - Caltech

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Sample vertex shaderuniform int ambientEnabled;varying vec3 normal, lightDir;void main() {normal = normalize(gl_NormalMatrix * gl_Normal);vec3 worldPos = vec3(gl_ModelViewMatrix * gl_Vertex);lightDir = normalize(vec3(gl_LightSource[0].position) - worldPos);gl_Position = ftransform();}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!