Beispiel #1
0
        public override void SetData(TextureUpload upload)
        {
            Debug.Assert(!isDisposed);

            if (upload.Bounds == Rectangle.Empty)
            {
                upload.Bounds = new Rectangle(0, 0, width, height);
            }

            IsTransparent = false;

            bool requireUpload = uploadQueue.Count == 0;

            uploadQueue.Enqueue(upload);
            if (requireUpload)
            {
                GLWrapper.EnqueueTextureUpload(this);
            }
        }
        public void SetData(byte[] data, Rectangle bounds, int level = 0, PixelFormat format = PixelFormat.Rgba)
        {
            Debug.Assert(!isDisposed);

            lock (this)
            {
                if (dataToBeUploaded != null)
                {
                    FreeBuffer(dataToBeUploaded);
                }

                formatToBeUploaded = format;
                levelToBeUploaded  = level;
                boundsToBeUploaded = bounds;
                dataToBeUploaded   = data;

                IsTransparent = false;

                GLWrapper.EnqueueTextureUpload(this);
            }
        }
        public override void SetData(TextureUpload upload)
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException(ToString(), "Can not set data of a disposed texture.");
            }

            if (upload.Bounds.IsEmpty)
            {
                upload.Bounds = new RectangleI(0, 0, width, height);
            }

            IsTransparent = false;

            bool requireUpload = uploadQueue.Count == 0;

            uploadQueue.Enqueue(upload);
            if (requireUpload)
            {
                GLWrapper.EnqueueTextureUpload(this);
            }
        }