コード例 #1
0
        public PixelBufferGL3x(
            BufferTarget type,
            BufferHint usageHint,
            int sizeInBytes)
        {
            if (sizeInBytes <= 0)
            {
                throw new ArgumentOutOfRangeException("sizeInBytes", "sizeInBytes must be greater than zero.");
            }

            _name = new BufferNameGL3x();

            _sizeInBytes = sizeInBytes;
            _type        = type;
            _usageHint   = TypeConverterGL3x.To(usageHint);

            //
            // Allocating here with GL.BufferData, then writing with GL.BufferSubData
            // in CopyFromSystemMemory() should not have any serious overhead:
            //
            //   http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=267373#Post267373
            //
            // Alternately, we can delay GL.BufferData until the first
            // CopyFromSystemMemory() call.
            //
            Bind();
            GL.BufferData(_type, new IntPtr(sizeInBytes), new IntPtr(), _usageHint);

            GC.AddMemoryPressure(sizeInBytes);
        }
コード例 #2
0
        public override void Bind(UniformBuffer uniformBuffer)
        {
            BufferNameGL3x bufferHandle = ((UniformBufferGL3x)uniformBuffer).Handle;

            GL.BindBufferBase(BufferTarget.UniformBuffer, _bindHandle, bufferHandle.Value);
        }