Topics for the day Theory Lighting models Ambient, Diffuse, Specular Computation of Normals Dot Products and cos(theta) Reading Assignment: * Overview -- http://www.opengl.org/developers/documentation/white_papers/oglGraphSys/opengl.html * Chapters 1,2 of OpenGL1.4 Specification: (pp. 1-60) http://www.opengl.org/developers/documentation/specs.html Manuals http://www.opengl.org/developers/documentation/ Practice: CallLists (.glGenLists gl NUMLISTS) --> returns integer and allocates NUMLISTS following integers (.glNewList gl INTEGER GL_COMPILE) --> stores list ...... (.glEndList gL) (.glCallList gl INTEGER) Lighting ... (import "gl4java.GLEnum") (.glEnable gl GTEnum.GL_LIGHT0$) (.glEnable gl GL_LIGHTING) (.glEnable gl GL_COLOR_MATERIAL) (let ( (LightAmbient (list->array float.class '(0.5f 0.5f 0.5f 1.0f))) ... ) (.glLightfv gl GL_LIGHT1 GL_AMBIENT LightAmbient) ... ) // Ambient light float[] LightAmbient = { 0.5f, 0.5f, 0.5f, 1.0f }; // Diffuse light float[] LightDiffuse = { 1.0f, 1.0f, 1.0f, 1.0f }; // Light position float[] LightPosition = { 0.0f, 0.0f, 2.0f, 1.0f }; // Enable light gl.glEnable(GL_LIGHT1); // Lights gl.glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); gl.glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); gl.glLightfv(GL_LIGHT1, GL_POSITION, LightPosition);