Exemplo n.º 1
0
        private void Compile()
        {
            int shaderHandle = CompileSingleShader(ShaderType.ComputeShader, ShaderPreparser.Preparse(ComputeFile, Media.ReadAllText(ComputeFile), ExportedConsts));

            Handle = GL.CreateProgram();

            GL.AttachShader(Handle, shaderHandle);

            GL.LinkProgram(Handle);

            int status_code;

            GL.GetProgram(Handle, GetProgramParameterName.LinkStatus, out status_code);
            Console.WriteLine(GL.GetProgramInfoLog(Handle));
            if (status_code != 1)
            {
                throw new ApplicationException("Linking error");
            }

            GL.UseProgram(Handle);

            Console.WriteLine(GL.GetProgramInfoLog(Handle));

            Compiled = true;
        }
Exemplo n.º 2
0
        public void Recompile()
        {
            UniformLocationsCache = new Dictionary <string, int>();

            VertexSource = ShaderPreparser.Preparse(VertexFile, Media.ReadAllText(VertexFile), ExportedConsts);
            if (FragmentFile != null)
            {
                FragmentSource = ShaderPreparser.Preparse(FragmentFile, Media.ReadAllText(FragmentFile), ExportedConsts);
            }
            if (GeometryFile != null)
            {
                GeometrySource = ShaderPreparser.Preparse(GeometryFile, Media.ReadAllText(GeometryFile), ExportedConsts);
            }
            if (TessControlFile != null && TessEvalFile != null)
            {
                TessControlSource    = ShaderPreparser.Preparse(TessControlFile, Media.ReadAllText(TessControlFile), ExportedConsts);
                TessEvaluationSource = ShaderPreparser.Preparse(TessEvalFile, Media.ReadAllText(TessEvalFile), ExportedConsts);
                UsingTessellation    = true;
            }
            Compiled = false;
        }