public void Link()
            {
                ClearCaches();
                _handle = (uint)GL.CreateProgram();
                if (Name != null)
                {
                    _clyde.ObjectLabelMaybe(ObjectLabelIdentifier.Program, _handle, Name);
                }

                if (_vertexShader != null)
                {
                    GL.AttachShader(_handle, _vertexShader.ObjectHandle);
                }

                if (_fragmentShader != null)
                {
                    GL.AttachShader(_handle, _fragmentShader.ObjectHandle);
                }

                GL.LinkProgram(_handle);

                GL.GetProgram(_handle, GetProgramParameterName.LinkStatus, out var compiled);
                if (compiled != 1)
                {
                    throw new ShaderCompilationException(GL.GetProgramInfoLog((int)_handle));
                }
            }
Example #2
0
 public GLShader(Clyde clyde, ShaderType type, string shaderSource, string?name = null)
 {
     _clyde = clyde;
     Compile(type, shaderSource);
     if (name != null)
     {
         _clyde.ObjectLabelMaybe(ObjectLabelIdentifier.Shader, ObjectHandle, name);
     }
 }
            public GLBuffer(Clyde clyde, BufferTarget type, BufferUsageHint usage, string?name = null)
            {
                _clyde    = clyde;
                Type      = type;
                Name      = name;
                UsageHint = usage;

                GL.GenBuffers(1, out uint handle);
                ObjectHandle = handle;

                GL.BindBuffer(type, handle);

                _clyde.ObjectLabelMaybe(ObjectLabelIdentifier.Buffer, ObjectHandle, name);
            }