Struct glium::pixel_buffer::PixelBuffer [] [src]

pub struct PixelBuffer<T> where T: PixelValue {
    // some fields omitted
}

Buffer that stores the content of a texture.

The generic type represents the type of pixels that the buffer contains.

Methods

impl<T> PixelBuffer<T> where T: PixelValue

fn new_empty<F>(facade: &F, capacity: usize) -> PixelBuffer<T> where F: Facade

Builds a new buffer with an uninitialized content.

fn read_as_texture_2d<S>(&self) -> Result<S, ReadError> where S: Texture2dDataSink<T>

Reads the content of the pixel buffer.

Methods from Deref<Target=BufferView<[T]>>

fn new<F>(facade: &F, data: &T, ty: BufferType, mode: BufferMode) -> Result<BufferView<T>, BufferCreationError> where F: Facade

Builds a new buffer containing the given data. The size of the buffer is equal to the size of the data.

fn empty_unsized<F>(facade: &F, ty: BufferType, size: usize, mode: BufferMode) -> Result<BufferView<T>, BufferCreationError> where F: Facade

Builds a new buffer of the given size.

fn get_context(&self) -> &Rc<Context>

Returns the context corresponding to this buffer.

fn get_size(&self) -> usize

Returns the size in bytes of this buffer.

fn is_persistent(&self) -> bool

Returns true if this buffer uses persistent mapping.

fn write(&self, data: &T)

Uploads some data in this buffer.

Panic

Panics if the length of data is different from the length of this buffer.

fn invalidate(&self)

Invalidates the content of the buffer. The data becomes undefined.

You should call this if you only use parts of a buffer. For example if you want to use the first half of the buffer, you invalidate the whole buffer then write the first half.

This operation is a no-op if the backend doesn't support it.

fn read(&self) -> Result<T, ReadError>

Reads the content of the buffer.

fn map(&mut self) -> Mapping<T>

Maps the buffer in memory for both reading and writing.

fn map_read(&mut self) -> ReadMapping<T>

Maps the buffer in memory for reading.

fn map_write(&mut self) -> WriteMapping<T>

Maps the buffer in memory for writing only.

fn as_slice_any(&self) -> BufferViewAnySlice

Builds a slice-any containing the whole subbuffer.

fn empty<F>(facade: &F, ty: BufferType, mode: BufferMode) -> Result<BufferView<T>, BufferCreationError> where F: Facade

Builds a new buffer of the given size.

fn empty_array<F>(facade: &F, ty: BufferType, len: usize, mode: BufferMode) -> Result<BufferView<[T]>, BufferCreationError> where F: Facade

Builds a new buffer of the given size.

fn len(&self) -> usize

Returns the number of elements in this buffer.

fn slice(&self, range: Range<usize>) -> Option<BufferViewSlice<[T]>>

Builds a slice of this subbuffer. Returns None if out of range.

fn slice_mut(&mut self, range: Range<usize>) -> Option<BufferViewMutSlice<[T]>>

Builds a slice of this subbuffer. Returns None if out of range.

fn as_slice(&self) -> BufferViewSlice<[T]>

Builds a slice containing the whole subbuffer.

fn as_mut_slice(&mut self) -> BufferViewMutSlice<[T]>

Builds a slice containing the whole subbuffer.

fn read_as_texture_1d<S>(&self) -> Result<S, ReadError> where S: Texture1dDataSink<T>

Reads the content of the buffer.

Trait Implementations

impl<T> Deref for PixelBuffer<T> where T: PixelValue

type Target = BufferView<[T]>

fn deref(&self) -> &BufferView<[T]>

impl<T> DerefMut for PixelBuffer<T> where T: PixelValue

fn deref_mut(&mut self) -> &mut BufferView<[T]>

impl<T> GlObject for PixelBuffer<T> where T: PixelValue

type Id = GLuint

fn get_id(&self) -> GLuint