Esempio n. 1
0
        /// <summary>
        /// Bind a portion of this buffer at a binding point in an indexed target
        /// </summary>
        /// <param name="bindingPoint"></param>
        /// <param name="start"></param>
        /// <param name="count"></param>
        public void BindAtUniformBlockBindingPoint(UniformBlockBindingPoint bindingPoint, long start, long count)
        {
            this.Assert();

            GL.BindBufferRange(
                BufferRangeTarget.UniformBuffer, bindingPoint.Index, Handle.Handle,
                (IntPtr)(start * TypeInfo <T> .TypeSize),
                (IntPtr)(count * TypeInfo <T> .TypeSize)
                );
        }
Esempio n. 2
0
        /// <summary>
        /// Set the binding point for a uniform block in the shader program
        /// </summary>
        /// <param name="uniformBlockName">The uniform block name</param>
        /// <param name="bindingPoint"></param>
        /// <exception cref="ArgumentException"></exception>
        public void SetUniformBlockBindingPoint(string uniformBlockName, UniformBlockBindingPoint bindingPoint)
        {
            Bind();
            var index = GL.GetUniformBlockIndex(Handle.Handle, uniformBlockName);

            if (index < 0)
            {
                throw new ArgumentException($"Uniform block with name \"{uniformBlockName}\" not defined in shader program");
            }
            GL.UniformBlockBinding(Handle.Handle, index, bindingPoint.Index);
        }
Esempio n. 3
0
        /*
         * /// <summary>
         * /// Bind this buffer at a binding point in an indexed target
         * /// </summary>
         * public void Bind(BufferRangeTarget target, int bindingPoint)
         * {
         *  this.Assert();
         *
         *  GL.BindBufferBase(target, bindingPoint, Handle.Handle);
         * }
         *
         * /// <summary>
         * /// Bind a portion of this buffer at a binding point in an indexed target
         * /// </summary>
         * public void Bind(BufferRangeTarget target, int bindingPoint, long start, long count)
         * {
         *  this.Assert();
         *
         *  GL.BindBufferRange(
         *          target, bindingPoint, Handle.Handle,
         *          (IntPtr)(start * GenericMath<T>.TypeSize),
         *          (IntPtr)(count * GenericMath<T>.TypeSize)
         *      );
         * }
         */

        /// <summary>
        /// Bind this buffer at a uniform block binding point
        /// </summary>
        /// <param name="bindingPoint"></param>
        public void BindAtUniformBlockBindingPoint(UniformBlockBindingPoint bindingPoint)
        {
            this.Assert();

            GL.BindBufferBase(BufferRangeTarget.UniformBuffer, bindingPoint.Index, Handle.Handle);
        }
Esempio n. 4
0
 /// <summary>
 /// Set the binding point for a uniform block in the shader program
 /// </summary>
 /// <param name="uniformBlockIndex">The uniform block index</param>
 /// <param name="bindingPoint">The binding point</param>
 public void SetUniformBlockBindingPoint(int uniformBlockIndex, UniformBlockBindingPoint bindingPoint)
 {
     Bind();
     GL.UniformBlockBinding(Handle.Handle, uniformBlockIndex, bindingPoint.Index);
 }