예제 #1
0
        /// <summary>
        /// Creates and compiles a shader object from <paramref name="shaderSource"/>.
        /// </summary>
        /// <param name="shaderSource">The shader's GLSL source code</param>
        /// <param name="shaderType">determines which shader stage this shader will be used for when linking the program.</param>
        public ShaderObject(string shaderSource, ShaderType shaderType) : base(GL.CreateShader(shaderType))
        {
            ShaderType = shaderType;

            if (!string.IsNullOrEmpty(shaderSource))
            {
                GL.ShaderSource(Id, shaderSource);
                GL.CompileShader(Id);
            }

            WasCompiledSuccessfully = ShaderValidation.GetShaderObjectCompileStatus(Id);
        }