Example #1
0
 public void Apply(Coord3d scale)
 {
     if (_enabled)
     {
         GL.MatrixMode(MatrixMode.Modelview);
         GL.LoadIdentity();
         GL.Translate(_position.x * scale.x, _position.y * scale.y, _position.z * scale.z);
         // Light position representation (cube)
         if ((_representationDisplayed))
         {
             GL.Disable(EnableCap.Lighting);
             GL.Color3(0.0, 1.0, 1.0);
             GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line);
             Glut.Glut.SolidCube(10);
             GL.Enable(EnableCap.Lighting);
         }
         // Actual light source setting	TODO: check we really need to define @ each rendering
         LightSwitch.Enable(_lightId);
         GL.Light(LightName.Light0, LightParameter.Position, _positionZero);
         GL.Light(LightName.Light0, LightParameter.Ambient, _ambiantColor.OpenTKColor4);
         GL.Light(LightName.Light0, LightParameter.Diffuse, _diffuseColor.OpenTKColor4);
         GL.Light(LightName.Light0, LightParameter.Specular, _specularColor.OpenTKColor4);
     }
     else
     {
         GL.Disable(EnableCap.Lighting);
     }
 }
Example #2
0
 public void apply(Coord3d scale)
 {
     if (_lazyLightInit)
     {
         initLight();
         foreach (Light alight in _lights)
         {
             LightSwitch.Enable(alight.Id);
             _lazyLightInit = false;
         }
     }
     foreach (Light alight in _lights)
     {
         alight.Apply(scale);
     }
 }