public void Link()
            {
                _uniformCache.Clear();
                _handle = GL.CreateProgram();
                if (Name != null)
                {
                    _clyde._objectLabelMaybe(ObjectLabelIdentifier.Program, _handle, Name);
                }

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

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

                GL.LinkProgram(_handle);

                GL.GetProgram(_handle, GetProgramParameterName.LinkStatus, out var compiled);
                if (compiled != 1)
                {
                    throw new ShaderCompilationException(GL.GetProgramInfoLog(_handle));
                }
            }
Beispiel #2
0
 public Shader(Clyde clyde, ShaderType type, string shaderSource, string name = null)
 {
     _clyde = clyde;
     Compile(type, shaderSource);
     if (name != null)
     {
         _clyde._objectLabelMaybe(ObjectLabelIdentifier.Shader, ObjectHandle, name);
     }
 }
Beispiel #3
0
            public Buffer(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;

                if (name != null)
                {
                    _clyde._objectLabelMaybe(ObjectLabelIdentifier.Buffer, ObjectHandle, name);
                }
            }
Beispiel #4
0
            public Buffer(Clyde clyde, BufferTarget type, BufferUsageHint usage, string name = null)
            {
                _clyde    = clyde;
                Type      = type;
                Name      = name;
                UsageHint = usage;

                Handle = GL.GenBuffer();
                Use();

                if (name != null)
                {
                    _clyde._objectLabelMaybe(ObjectLabelIdentifier.Buffer, Handle, name);
                }
            }