public IShader Compile() { if (_hadCompilationErrors) { return(null); } if (_isCompiled) { return(this); } if (!_graphics.AreShadersSupported()) { Debug.WriteLine("Shaders are not supported on this system."); _hadCompilationErrors = true; return(null); } _program = _graphics.CreateProgram(); if (!compileShader(_fragmentSource, ShaderMode.FragmentShader) || !compileShader(_vertexSource, ShaderMode.VertexShader)) { _hadCompilationErrors = true; return(null); } if (!linkProgram()) { _hadCompilationErrors = true; return(null); } _isCompiled = true; return(this); }