Exemplo n.º 1
0
        private static int LoadShader(int type, String source)
        {
            int id = GLES20.CreateShader(type);

            if (id == 0)
            {
                throw new Exception("Could not create shader.");
            }

            GLES20.ShaderSource(id, source);

            GLES20.CompileShader(id);

            int status;

            GLES20.GetShaderiv(id, GLES20.GL_COMPILE_STATUS, out status);

            if (status == 0)
            {
                String log = GLES20.GetShaderInfoLog(id);

                GLES20.DeleteShader(id);

                throw new Exception("Error compiling shader: " + log);
            }

            return(id);
        }