Exemplo n.º 1
0
		public void Setup ()
		{
			program = new GLProgram ("Shader", "Shader");

			program.AddAttribute ("position");
			program.AddAttribute ("textureCoordinates");

			if (!program.Link ()) {
				Console.WriteLine ("Link failed.");
				Console.WriteLine (String.Format ("Program Log: {0}", program.ProgramLog ()));
				Console.WriteLine (String.Format ("Fragment Log: {0}", program.FragmentShaderLog ()));
				Console.WriteLine (String.Format ("Vertex Log: {0}", program.VertexShaderLog ()));

				(View as GLView).StopAnimation ();
				program = null;

				return;
			}

			positionAttribute = program.GetAttributeIndex ("position");
			textureCoordinateAttribute = program.GetAttributeIndex ("textureCoordinates");
			matrixUniform = program.GetUniformIndex ("matrix");
			textureUniform = program.GetUniformIndex ("texture");

			GL.Enable (EnableCap.DepthTest);
			GL.Enable (EnableCap.CullFace);
			GL.Enable (EnableCap.Texture2D);
			GL.Enable (EnableCap.Blend);
			GL.BlendFunc (BlendingFactorSrc.One, BlendingFactorDest.Zero);

			texture = new GLTexture ("DieTexture.png");
		}
Exemplo n.º 2
0
        public void Setup()
        {
            program = new GLProgram("Shader", "Shader");

            program.AddAttribute("position");
            program.AddAttribute("textureCoordinates");

            if (!program.Link())
            {
                Console.WriteLine("Link failed.");
                Console.WriteLine(String.Format("Program Log: {0}", program.ProgramLog()));
                Console.WriteLine(String.Format("Fragment Log: {0}", program.FragmentShaderLog()));
                Console.WriteLine(String.Format("Vertex Log: {0}", program.VertexShaderLog()));

                (View as GLView).StopAnimation();
                program = null;

                return;
            }

            positionAttribute          = program.GetAttributeIndex("position");
            textureCoordinateAttribute = program.GetAttributeIndex("textureCoordinates");
            matrixUniform  = program.GetUniformIndex("matrix");
            textureUniform = program.GetUniformIndex("texture");

            GL.Enable(EnableCap.DepthTest);
            GL.Enable(EnableCap.CullFace);
            GL.Enable(EnableCap.Texture2D);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.Zero);

            texture = new GLTexture("DieTexture.png");
        }