public void Draw() { this.SetAmbientLight(); this.SetDiffuseLight(); this.SetSpecularLight(); Gl.glPushMatrix(); Gl.glRotatef(this.AngleX, 1, 0, 0); Gl.glRotatef(this.AngleY, 0, 1, 0); Gl.glRotatef(this.AngleZ, 0, 0, 1); Gl.glLightfv((uint)this.GlLight, Gl.GL_POSITION, LightPosition); Gl.glPopMatrix(); Gl.glEnable((uint)this.GlLight); }
public Light(int GlLight, float[] LightPosition) { this.GlLight = GlLight; this.IsAmbientLightEnabled = true; this.IsDiffuseLightEnabled = true; this.IsSpecularLightEnabled = false; this.LightPosition = LightPosition; this.AmbientLight = new float[3] { .2f, .2f, .2f }; this.DiffuseLight = new float[3] { .8f, .8f, .8f }; this.SpecularLight = new float[3] { .7f, .7f, .7f }; this.Specularity = new float[3] { .2f, .2f, .2f }; this.Blackout = new float[3] { 0f, 0f, 0f }; Gl.glEnable(Gl.GL_LIGHTING); Gl.glEnable(Gl.GL_COLOR_MATERIAL); // Habilita o modelo de colorização de Gouraud Gl.glShadeModel(Gl.GL_SMOOTH); // Define a refletância do material Gl.glMaterialfv(Gl.GL_FRONT, Gl.GL_SPECULAR, Specularity); Gl.glMaterialfv(Gl.GL_BACK, Gl.GL_SPECULAR, Specularity); // Define a concentração do brilho Gl.glMateriali(Gl.GL_FRONT, Gl.GL_SHININESS, 100); Gl.glMateriali(Gl.GL_BACK, Gl.GL_SHININESS, 100); }