Initialize() public method

Initialize this shader program object.
public Initialize ( ) : void
return void
Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ShaderProgram GetShaderProgram()
        {
            var program = new ShaderProgram();

            program.Initialize(shaders);

            return(program);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ShaderProgram GetShaderProgram()
        {
            if (this.program == null)
            {
                var program = new ShaderProgram();
                if (this.feedbackVaryings != null)
                {
                    program.Initialize(this.feedbackVaryings, this.mode, this.shaders);
                }
                else
                {
                    program.Initialize(this.shaders);
                }

                this.program = program;
            }

            return(this.program);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a shader program object by a single shader.
        /// </summary>
        /// <param name="shaderCode"></param>
        /// <returns></returns>
        public static ShaderProgram CreateProgram(this ShaderCode shaderCode)
        {
            var    program = new ShaderProgram();
            Shader shader  = shaderCode.CreateShader();

            program.Initialize(shader);

            shader.Dispose();

            return(program);
        }
        /// <summary>
        ///
        /// </summary>
        public static ShaderProgram GetHighlightShaderProgram()
        {
            var shaderCodes = new ShaderCode[2];
            shaderCodes[0] = new ShaderCode(GetShaderSource(ShaderType.VertexShader), ShaderType.VertexShader);
            shaderCodes[1] = new ShaderCode(GetShaderSource(ShaderType.FragmentShader), ShaderType.FragmentShader);

            var shaderProgram = new ShaderProgram();
            shaderProgram.Initialize((from item in shaderCodes select item.CreateShader()).ToArray());

            return shaderProgram;
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        public static ShaderProgram GetHighlightShaderProgram()
        {
            var shaderCodes = new ShaderCode[2];

            shaderCodes[0] = new ShaderCode(GetShaderSource(ShaderType.VertexShader), ShaderType.VertexShader);
            shaderCodes[1] = new ShaderCode(GetShaderSource(ShaderType.FragmentShader), ShaderType.FragmentShader);

            var shaderProgram = new ShaderProgram();

            shaderProgram.Initialize((from item in shaderCodes select item.CreateShader()).ToArray());

            return(shaderProgram);
        }
Esempio n. 6
0
        /// <summary>
        /// Creates a shader program by multiple shaders.
        /// </summary>
        /// <param name="shaderCodes"></param>
        /// <returns></returns>
        public static ShaderProgram CreateProgram(this ShaderCode[] shaderCodes)
        {
            var program = new ShaderProgram();

            Shader[] shaders = (from item in shaderCodes select item.CreateShader()).ToArray();
            program.Initialize(shaders);

            foreach (Shader item in shaders)
            {
                item.Dispose();
            }

            return(program);
        }
Esempio n. 7
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ShaderProgram GetShaderProgram()
        {
            var program = new ShaderProgram();

            program.Initialize(shaders);

            return(program);
            //return this.shaderCodes.CreateProgram();
            //if (this.program == null)
            //{
            //	this.program = this.shaderCodes.CreateProgram();
            //	this.shaderCodes = null;
            //}
            //return this.program;
        }
Esempio n. 8
0
        /// <summary>
        /// Creates a shader program object by a single shader.
        /// </summary>
        /// <param name="shaderCode"></param>
        /// <returns></returns>
        public static ShaderProgram CreateProgram(this ShaderCode shaderCode)
        {
            var program = new ShaderProgram();
            Shader shader = shaderCode.CreateShader();
            program.Initialize(shader);

            shader.Dispose();

            return program;
        }
Esempio n. 9
0
        /// <summary>
        /// Creates a shader program by multiple shaders.
        /// </summary>
        /// <param name="shaderCodes"></param>
        /// <returns></returns>
        public static ShaderProgram CreateProgram(this ShaderCode[] shaderCodes)
        {
            var program = new ShaderProgram();
            Shader[] shaders = (from item in shaderCodes select item.CreateShader()).ToArray();
            program.Initialize(shaders);

            foreach (Shader item in shaders) { item.Dispose(); }

            return program;
        }