Exemple #1
0
        public bool AttachShader(GlShader shader)
        {
            if (Id < 0 ||
                shader == null ||
                shader.Id < 0)
            {
                Message = "AttachShader: invalid program or shader.";
                Status  = 0;
                return(false);
            }

            GlShader old;

            shaders.TryGetValue(shader.Type, out old);
            if (old != null)
            {
                GL.DetachShader(Id, old.Id);
                old.Dispose();
            }

            GL.AttachShader(Id, shader.Id);

            // ??? How to test if everything went well ???
            Status  = 1;
            Message = GL.GetProgramInfoLog(Id);

            shaders[shader.Type] = shader;

            return(true);
        }
Exemple #2
0
 public GlShaderInfo(ShaderType st, string source, string hint = null)
 {
     type       = st;
     sourceFile = source;
     hintDir    = hint;
     shader     = null;
 }
Exemple #3
0
 public void Destroy()
 {
     if (shader != null)
     {
         shader.Dispose();
         shader = null;
     }
 }
 public bool Compile()
 {
     shader = new GlShader();
     if (!shader.CompileShader(type, sourceFile, hintDir))
     {
         Util.LogFormat("{0} compile error: {1} .. giving up", type.ToString(), shader.Message);
         shader.Dispose();
         shader = null;
         return(false);
     }
     return(true);
 }