Example #1
0
 /// <summary>
 /// Compiles and links vertex and fragment shaders from strings.
 /// </summary>
 /// <param name="sVertexShd_">The s vertex SHD_.</param>
 /// <param name="sFragmentShd_">The s fragment SHD_.</param>
 /// <returns>a new instance</returns>
 public static Shader FromStrings(string sVertexShd_, string sFragmentShd_)
 {
     Shader shd = new Shader();
     try
     {
         shd.Compile(sVertexShd_, ShaderType.VertexShader);
         shd.Compile(sFragmentShd_, ShaderType.FragmentShader);
         shd.Link();
     }
     catch(Exception e)
     {
         shd.Dispose();
         throw e;
     }
     return shd;
 }
Example #2
0
        /// <summary>
        /// Compiles and links vertex and fragment shaders from strings.
        /// </summary>
        /// <param name="sVertexShd_">The s vertex SHD_.</param>
        /// <param name="sFragmentShd_">The s fragment SHD_.</param>
        /// <returns>a new instance</returns>
        public static Shader FromStrings(string sVertexShd_, string sFragmentShd_)
        {
            Shader shd = new Shader();

            try
            {
                shd.Compile(sVertexShd_, ShaderType.VertexShader);
                shd.Compile(sFragmentShd_, ShaderType.FragmentShader);
                shd.Link();
            }
            catch (Exception e)
            {
                shd.Dispose();
                throw e;
            }
            return(shd);
        }