Example #1
0
        private void gl_Load(object sender, EventArgs e)
        {
            // Perspectivas
            GL.Viewport(0, 0, gl.Size.Width - 1, gl.Size.Height - 1);
            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadIdentity();
            Glu.Perspective(90, (gl.Size.Width / gl.Size.Height), 0.1f, 10000f);
            GL.MatrixMode(MatrixMode.Modelview);
            //--


            // Profundidad
            GL.ClearColor(Color.Black);
            GL.ClearDepth(1.0);
            GL.Enable(EnableCap.DepthTest);
            GL.DepthFunc(DepthFunction.Lequal);
            //--


            // Tipo de Material
            float[] mat_especular = { 1.0f, 1.0f, 1.0f, 1.0f };
            float[] mat_brillo    = { 50.0f };

            GL.ShadeModel(ShadingModel.Smooth);
            GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Specular, mat_especular);
            GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Shininess, mat_brillo);
            GL.Enable(EnableCap.ColorMaterial);
            //--


            // Textura
            GL.Enable(EnableCap.Texture2D);
            //--


            // Camara
            camare = new Engine.Camera(0, 0, -10, 0, 0, -1, 4, 2.0, 0.2, 0.1, 0.5);
            //--


            // Luz
            float[] white = { 1.0f, 1.0f, 1.0f, 1.0f };
            ligth = new Engine.Light();

            GL.Light(LightName.Light0, LightParameter.Ambient, white);
            GL.Light(LightName.Light0, LightParameter.Diffuse, white);
            GL.Light(LightName.Light0, LightParameter.Specular, white);
            GL.Light(LightName.Light0, LightParameter.SpotCutoff, 10);
            GL.Light(LightName.Light0, LightParameter.ConstantAttenuation, 2);
            GL.Enable(EnableCap.Light0);
            //--


            // Trucos
            GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);
            //--


            // Preconfiguracion de presentacion y nivel
            level        = -1;
            template     = Engine.Template.levelCompleted(-2);
            ligth.turnOn = false;
            drawTemplate();
            camare.levelCompleted = true;
            //--


            // Iniciar sonido
            Engine.Sound.play("init.wav");
            //--
        }
Example #2
0
        private void gl_Load(object sender, EventArgs e)
        {
            // Perspectivas
            GL.Viewport(0, 0, gl.Size.Width - 1, gl.Size.Height - 1);
            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadIdentity();
            Glu.Perspective(90, (gl.Size.Width / gl.Size.Height), 0.1f, 10000f);
            GL.MatrixMode(MatrixMode.Modelview);
            //--

            // Profundidad
            GL.ClearColor(Color.Black);
            GL.ClearDepth(1.0);
            GL.Enable(EnableCap.DepthTest);
            GL.DepthFunc(DepthFunction.Lequal);
            //--

            // Tipo de Material
            float[] mat_especular = { 1.0f, 1.0f, 1.0f, 1.0f };
            float[] mat_brillo = { 50.0f };

            GL.ShadeModel(ShadingModel.Smooth);
            GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Specular, mat_especular);
            GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Shininess, mat_brillo);
            GL.Enable(EnableCap.ColorMaterial);
            //--

            // Textura
            GL.Enable(EnableCap.Texture2D);
            //--

            // Camara
            camare = new Engine.Camera(0, 0, -10, 0, 0, -1, 4, 2.0, 0.2, 0.1, 0.5);
            //--

            // Luz
            float[] white = { 1.0f, 1.0f, 1.0f, 1.0f };
            ligth = new Engine.Light();

            GL.Light(LightName.Light0, LightParameter.Ambient, white);
            GL.Light(LightName.Light0, LightParameter.Diffuse, white);
            GL.Light(LightName.Light0, LightParameter.Specular, white);
            GL.Light(LightName.Light0, LightParameter.SpotCutoff, 10);
            GL.Light(LightName.Light0, LightParameter.ConstantAttenuation, 2);
            GL.Enable(EnableCap.Light0);
            //--

            // Trucos
            GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.One);
            //--

            // Preconfiguracion de presentacion y nivel
            level = -1;
            template = Engine.Template.levelCompleted(-2);
            ligth.turnOn = false;
            drawTemplate();
            camare.levelCompleted = true;
            //--

            // Iniciar sonido
            Engine.Sound.play("init.wav");
            //--
        }