示例#1
0
        public static ShaderProgram CreateProgram(IGraphicsContext context, string vertexSource, string fragmentSource)
        {
            int vertID = context.CreateShader(ShaderType.VertexShader);
            int fragID = context.CreateShader(ShaderType.FragmentShader);


            context.ShaderSource(vertID, vertexSource);
            context.ShaderSource(fragID, fragmentSource);

            context.CompileShader(vertID);
            context.CompileShader(fragID);

            Debug.LogInfo(context.GetShaderInfoLog(vertID));
            Debug.LogInfo(context.GetShaderInfoLog(fragID));

            int programID = context.CreateProgram();

            context.AttachShader(programID, vertID);
            context.AttachShader(programID, fragID);

            context.LinkProgram(programID);

            Debug.LogInfo(context.GetProgramInfoLog(programID));

            return(new ShaderProgram(context, vertID, fragID, programID));
        }
        public static ShaderProgram CreateProgram(IGraphicsContext context, string vertexSource, string fragmentSource)
        {
            int vertID = context.CreateShader(ShaderType.VertexShader);
            int fragID = context.CreateShader(ShaderType.FragmentShader);

            context.ShaderSource(vertID, vertexSource);
            context.ShaderSource(fragID, fragmentSource);

            context.CompileShader(vertID);
            context.CompileShader(fragID);

            Debug.LogInfo(context.GetShaderInfoLog(vertID));
            Debug.LogInfo(context.GetShaderInfoLog(fragID));

            int programID = context.CreateProgram();

            context.AttachShader(programID, vertID);
            context.AttachShader(programID, fragID);

            context.LinkProgram(programID);

            Debug.LogInfo(context.GetProgramInfoLog(programID));

            return new ShaderProgram(context, vertID, fragID, programID);
        }
        public string GetShaderInfoLog(int vertID)
        {
            var tmp = forwarding.GetShaderInfoLog(vertID);

            CheckGLError();
            GLCALLS++;
            return(tmp);
        }