Ejemplo n.º 1
0
        public static void Init(ZApplication app)
        {
            defaultMaterial = new Material(null);
            GUIMaterial = new Material(null);
            GUIMaterial.Lighting = false;            
            defaultTexture = new Texture(null);
            defaultFont = new Font(null);

            GL.MatrixMode(All.MODELVIEW);
          
            GL.Enable(All.DEPTH_TEST);           

            //Enable Light
            //Use default position
            GL.Enable(All.LIGHTING);
            GL.Enable(All.LIGHT0);

            //Use glColor to color materials. 
            //This eliminates the need to set ambient and diffuse separately.
            GL.Enable(All.COLOR_MATERIAL);
            GL.ColorMaterial(All.FRONT_AND_BACK, All.AMBIENT_AND_DIFFUSE);

            //glMaterialfv(GL_FRONT, GL_SPECULAR, Specular);
            //glMaterialf(GL_FRONT, GL_SHININESS, LowShininess);         

            // IMPORTANT: Otherwise light will arise with scaled vectors, e.g. with Scale=0.1 then it will be too bright
            // This is because gl scales the normals with glScale
            //GL.Enable(All.NORMALIZE);

            var shape = new UnitQuad();
            unitQuad = new Mesh(null) { Name = "UnitQuad" };            
            unitQuad.CreateVBO(shape);

            defaultMaterial.Apply(null);            
        }