Exemplo n.º 1
0
        /// <summary>
        /// Binds the given <see cref="PixelBuffer"/> object to the <see cref="RenderContext"/>.
        /// </summary>
        /// <param name="pbo">The <see cref="PixelBuffer"/> object to bind.</param>
        public void BindPixelBuffer(PixelBuffer pbo)
        {
            if (pbo == null)
            {
                if (PixelBufferHandle == GLHandle.Zero)
                {
                    return;
                }

                GL.BindBuffer(BufferTarget.PixelUnpackBuffer, GLHandle.Zero);

                PixelBufferHandle        = GLHandle.Zero;
                PixelBuffer.BoundContext = null;
                PixelBuffer = null;

                return;
            }

            pbo.EnsureUndisposed();

            if (PixelBufferHandle == pbo.Handle)
            {
                return;
            }

            GL.BindBuffer(BufferTarget.PixelUnpackBuffer, pbo.Handle);

            PixelBufferHandle        = pbo.Handle;
            PixelBuffer              = pbo;
            PixelBuffer.BoundContext = this;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Binds the given <see cref="PixelBuffer"/> object to the <see cref="RenderContext"/>.
        /// </summary>
        /// <param name="pbo">The <see cref="PixelBuffer"/> object to bind.</param>
        public void BindPixelBuffer(PixelBuffer pbo)
        {
            if (pbo == null)
            {
                throw new ArgumentNullException(nameof(pbo));
            }

            pbo.EnsureUndisposed();

            if (_pixelBufferHandle == pbo.Handle)
            {
                return;
            }

            GL.BindBuffer(BufferTarget.PixelUnpackBuffer, pbo.Handle);

            _pixelBufferHandle        = pbo.Handle;
            _pixelBuffer              = pbo;
            _pixelBuffer.BoundContext = this;
        }