public void Create(uint shaderType, string source) { // Create the OpenGL shader object. ShaderObject = GL.CreateShader(shaderType); if (ShaderObject == null) { throw new InvalidOperationException("GL.CreateShader failed."); } // Set the shader source. GL.ShaderSource(ShaderObject, source); // Compile the shader object. GL.CompileShader(ShaderObject); // Now that we've compiled the shader, check it's compilation status. If it's not compiled properly, we're // going to throw an exception. if (GetCompileStatus() == false) { string log = GetInfoLog(); throw new ShaderCompilationException( $"Failed to compile shader with ID {this.ShaderObject}. Log: {log}", log); } }