Ejemplo n.º 1
0
        /// <summary>
        ///     Loads the shader to the GPU.
        /// </summary>
        public void Load()
        {
            _id      = GL.CreateProgram();
            Uniforms = new UniformCollection {
                ParentShader = this
            };

            ErrorInShader = !ShaderFiles.Append(this);
            if (ErrorInShader)
            {
                GL.DeleteProgram(_id);
                return;
            }
            GL.LinkProgram(_id);
            ShaderFiles.Detach(this);

            Uniforms.Import(this);

            GLDebugging.CheckGLErrors($"A error occured at shader creation for '{GetType()}': %code%");
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     This create a new uniform manager
 /// </summary>
 /// <param name="location">Location id</param>
 /// <param name="parent">Parent collection</param>
 public Uniform(int location, UniformCollection parent)
 {
     Location = location;
     Parent   = parent;
 }
Ejemplo n.º 3
0
 /// <summary>
 ///     This creates a new uniform manager, that get the location from the provided shader and with a parent.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="shader"></param>
 /// <param name="parent"></param>
 public Uniform(string name, GenericShader shader, UniformCollection parent) : this(GL.GetUniformLocation(shader, name), parent)
 {
 }