C# Class CSharpGL.Buffer

Datei anzeigen Open project: bitzhuwei/CSharpGL

Public Methods

Method Description
Bind ( ) : void

Bind this buffer.

ClearBufferData ( uint internalFormat, uint format, uint type, IntPtr data, bool autoBind = true ) : bool

Fill a buffer object's data store with a fixed value.

ClearBufferData ( uint internalFormat, uint format, uint type, UnmanagedArrayBase data, bool autoBind = true ) : bool

Fill a buffer object's data store with a fixed value.

ClearBufferData ( vec3 data, bool autoBind = true ) : bool

Fill a buffer object's data store with a fixed value.

ClearBufferSubData ( int offset, uint size, vec3 data, bool autoBind = true ) : bool

Fill all or part of buffer object's data store with a fixed value.

ClearBufferSubData ( uint internalFormat, IntPtr offset, uint size, uint format, uint type, IntPtr data, bool autoBind = true ) : bool

Fill all or part of buffer object's data store with a fixed value.

ClearBufferSubData ( uint internalFormat, IntPtr offset, uint size, uint format, uint type, UnmanagedArrayBase data, bool autoBind = true ) : bool

Fill all or part of buffer object's data store with a fixed value.

Create ( IndependentBufferTarget target, Type elementType, int length, BufferUsage usage ) : Buffer

Creates a sub-type of Buffer object directly in server side(GPU) without initializing its value.

Create ( IndexBufferElementType type, int length, DrawMode mode, BufferUsage usage ) : OneIndexBuffer

Creates a OneIndexBuffer object directly in server side(GPU) without initializing its value.

Create ( Type elementType, int length, VBOConfig config, string varNameInVertexShader, BufferUsage usage, uint instanceDivisor, int patchVertexes ) : VertexBuffer

Creates a VertexBuffer object(actually an array) directly in server side(GPU) without initializing its value.

Create ( DrawMode mode, int firstVertex, int vertexCount, int primCount = 1 ) : ZeroIndexBuffer

Creates a ZeroIndexBuffer object directly in server side(GPU) without initializing its value.

Dispose ( ) : void

DumpBufferTexture ( uint internalFormat, bool autoDispose ) : Texture

Dump a Texture filled with this Buffer.

MapBuffer ( MapBufferAccess access, bool bind = true ) : IntPtr

Start to read/write buffer.

MapBufferRange ( int offset, int length, MapBufferRangeAccess access, bool bind = true ) : IntPtr

Start to read/write buffer.

Unbind ( ) : void

Unind this buffer.

UnmapBuffer ( bool unbind = true ) : bool

Stop reading/writing buffer.

Protected Methods

Method Description
Buffer ( uint bufferId, int length, int byteLength ) : System

位于服务器端(GPU内存)的定长数组。

An array at server side (GPU memory) with fixed length.

DisposeManagedResources ( ) : void

DisposeUnmanagedResources ( ) : void

Private Methods

Method Description
Dispose ( bool disposing ) : void
GetSize ( IndexBufferElementType type ) : int

Method Details

Bind() public method

Bind this buffer.
public Bind ( ) : void
return void

Buffer() protected method

位于服务器端(GPU内存)的定长数组。

An array at server side (GPU memory) with fixed length.

protected Buffer ( uint bufferId, int length, int byteLength ) : System
bufferId uint 用glGenBuffers()得到的VBO的Id。Id got from glGenBuffers();
length int 此VBO含有多少个元素?How many elements?
byteLength int 此VBO中的数据在内存中占用多少个字节?How many bytes in this buffer?
return System

ClearBufferData() public method

Fill a buffer object's data store with a fixed value.
public ClearBufferData ( uint internalFormat, uint format, uint type, IntPtr data, bool autoBind = true ) : bool
internalFormat uint The sized internal format with which the data will be stored in the buffer object.
format uint Specifies the format of the pixel data. For transfers of depth, stencil, or depth/stencil data, you must use GL_DEPTH_COMPONENT​, GL_STENCIL_INDEX​, or GL_DEPTH_STENCIL​, where appropriate. For transfers of normalized integer or floating-point color image data, you must use one of the following: GL_RED​, GL_GREEN​, GL_BLUE​, GL_RG​, GL_RGB​, GL_BGR​, GL_RGBA​, and GL_BGRA​. For transfers of non-normalized integer data, you must use one of the following: GL_RED_INTEGER​, GL_GREEN_INTEGER​, GL_BLUE_INTEGER​, GL_RG_INTEGER​, GL_RGB_INTEGER​, GL_BGR_INTEGER​, GL_RGBA_INTEGER​, and GL_BGRA_INTEGER​.
type uint Specifies the data type of the pixel data. The following symbolic values are accepted: GL_UNSIGNED_BYTE​, GL_BYTE​, GL_UNSIGNED_SHORT​, GL_SHORT​, GL_UNSIGNED_INT​, GL_INT​, GL_FLOAT​, GL_UNSIGNED_BYTE_3_3_2​, GL_UNSIGNED_BYTE_2_3_3_REV​, GL_UNSIGNED_SHORT_5_6_5​, GL_UNSIGNED_SHORT_5_6_5_REV​, GL_UNSIGNED_SHORT_4_4_4_4​, GL_UNSIGNED_SHORT_4_4_4_4_REV​, GL_UNSIGNED_SHORT_5_5_5_1​, GL_UNSIGNED_SHORT_1_5_5_5_REV​, GL_UNSIGNED_INT_8_8_8_8​, GL_UNSIGNED_INT_8_8_8_8_REV​, GL_UNSIGNED_INT_10_10_10_2​, and GL_UNSIGNED_INT_2_10_10_10_REV​.
data System.IntPtr Specifies a pointer to a single pixel of data to upload. This parameter may not be IntPtr.Zero.
autoBind bool Automatically call glBindBuffer() inside this method.
return bool

ClearBufferData() public method

Fill a buffer object's data store with a fixed value.
public ClearBufferData ( uint internalFormat, uint format, uint type, UnmanagedArrayBase data, bool autoBind = true ) : bool
internalFormat uint The sized internal format with which the data will be stored in the buffer object.
format uint Specifies the format of the pixel data. For transfers of depth, stencil, or depth/stencil data, you must use GL_DEPTH_COMPONENT​, GL_STENCIL_INDEX​, or GL_DEPTH_STENCIL​, where appropriate. For transfers of normalized integer or floating-point color image data, you must use one of the following: GL_RED​, GL_GREEN​, GL_BLUE​, GL_RG​, GL_RGB​, GL_BGR​, GL_RGBA​, and GL_BGRA​. For transfers of non-normalized integer data, you must use one of the following: GL_RED_INTEGER​, GL_GREEN_INTEGER​, GL_BLUE_INTEGER​, GL_RG_INTEGER​, GL_RGB_INTEGER​, GL_BGR_INTEGER​, GL_RGBA_INTEGER​, and GL_BGRA_INTEGER​.
type uint Specifies the data type of the pixel data. The following symbolic values are accepted: GL_UNSIGNED_BYTE​, GL_BYTE​, GL_UNSIGNED_SHORT​, GL_SHORT​, GL_UNSIGNED_INT​, GL_INT​, GL_FLOAT​, GL_UNSIGNED_BYTE_3_3_2​, GL_UNSIGNED_BYTE_2_3_3_REV​, GL_UNSIGNED_SHORT_5_6_5​, GL_UNSIGNED_SHORT_5_6_5_REV​, GL_UNSIGNED_SHORT_4_4_4_4​, GL_UNSIGNED_SHORT_4_4_4_4_REV​, GL_UNSIGNED_SHORT_5_5_5_1​, GL_UNSIGNED_SHORT_1_5_5_5_REV​, GL_UNSIGNED_INT_8_8_8_8​, GL_UNSIGNED_INT_8_8_8_8_REV​, GL_UNSIGNED_INT_10_10_10_2​, and GL_UNSIGNED_INT_2_10_10_10_REV​.
data UnmanagedArrayBase Specifies a pointer to a single pixel of data to upload. This parameter may not be null.
autoBind bool Automatically call glBindBuffer() inside this method.
return bool

ClearBufferData() public method

Fill a buffer object's data store with a fixed value.
public ClearBufferData ( vec3 data, bool autoBind = true ) : bool
data vec3
autoBind bool Automatically call glBindBuffer() inside this method.
return bool

ClearBufferSubData() public method

Fill all or part of buffer object's data store with a fixed value.
public ClearBufferSubData ( int offset, uint size, vec3 data, bool autoBind = true ) : bool
offset int The offset, in basic machine units into the buffer object's data store at which to start filling.
size uint The size, in basic machine units of the range of the data store to fill.
data vec3 Specifies a pointer to a single pixel of data to upload. This parameter may not be null.
autoBind bool Automatically call glBindBuffer() inside this method.
return bool

ClearBufferSubData() public method

Fill all or part of buffer object's data store with a fixed value.
public ClearBufferSubData ( uint internalFormat, IntPtr offset, uint size, uint format, uint type, IntPtr data, bool autoBind = true ) : bool
internalFormat uint The sized internal format with which the data will be stored in the buffer object.
offset System.IntPtr The offset, in basic machine units into the buffer object's data store at which to start filling.
size uint The size, in basic machine units of the range of the data store to fill.
format uint Specifies the format of the pixel data. For transfers of depth, stencil, or depth/stencil data, you must use GL_DEPTH_COMPONENT​, GL_STENCIL_INDEX​, or GL_DEPTH_STENCIL​, where appropriate. For transfers of normalized integer or floating-point color image data, you must use one of the following: GL_RED​, GL_GREEN​, GL_BLUE​, GL_RG​, GL_RGB​, GL_BGR​, GL_RGBA​, and GL_BGRA​. For transfers of non-normalized integer data, you must use one of the following: GL_RED_INTEGER​, GL_GREEN_INTEGER​, GL_BLUE_INTEGER​, GL_RG_INTEGER​, GL_RGB_INTEGER​, GL_BGR_INTEGER​, GL_RGBA_INTEGER​, and GL_BGRA_INTEGER​.
type uint Specifies the data type of the pixel data. The following symbolic values are accepted: GL_UNSIGNED_BYTE​, GL_BYTE​, GL_UNSIGNED_SHORT​, GL_SHORT​, GL_UNSIGNED_INT​, GL_INT​, GL_FLOAT​, GL_UNSIGNED_BYTE_3_3_2​, GL_UNSIGNED_BYTE_2_3_3_REV​, GL_UNSIGNED_SHORT_5_6_5​, GL_UNSIGNED_SHORT_5_6_5_REV​, GL_UNSIGNED_SHORT_4_4_4_4​, GL_UNSIGNED_SHORT_4_4_4_4_REV​, GL_UNSIGNED_SHORT_5_5_5_1​, GL_UNSIGNED_SHORT_1_5_5_5_REV​, GL_UNSIGNED_INT_8_8_8_8​, GL_UNSIGNED_INT_8_8_8_8_REV​, GL_UNSIGNED_INT_10_10_10_2​, and GL_UNSIGNED_INT_2_10_10_10_REV​.
data System.IntPtr Specifies a pointer to a single pixel of data to upload. This parameter may not be IntPtr.Zero.
autoBind bool Automatically call glBindBuffer() inside this method.
return bool

ClearBufferSubData() public method

Fill all or part of buffer object's data store with a fixed value.
public ClearBufferSubData ( uint internalFormat, IntPtr offset, uint size, uint format, uint type, UnmanagedArrayBase data, bool autoBind = true ) : bool
internalFormat uint The sized internal format with which the data will be stored in the buffer object.
offset System.IntPtr The offset, in basic machine units into the buffer object's data store at which to start filling.
size uint The size, in basic machine units of the range of the data store to fill.
format uint Specifies the format of the pixel data. For transfers of depth, stencil, or depth/stencil data, you must use GL_DEPTH_COMPONENT​, GL_STENCIL_INDEX​, or GL_DEPTH_STENCIL​, where appropriate. For transfers of normalized integer or floating-point color image data, you must use one of the following: GL_RED​, GL_GREEN​, GL_BLUE​, GL_RG​, GL_RGB​, GL_BGR​, GL_RGBA​, and GL_BGRA​. For transfers of non-normalized integer data, you must use one of the following: GL_RED_INTEGER​, GL_GREEN_INTEGER​, GL_BLUE_INTEGER​, GL_RG_INTEGER​, GL_RGB_INTEGER​, GL_BGR_INTEGER​, GL_RGBA_INTEGER​, and GL_BGRA_INTEGER​.
type uint Specifies the data type of the pixel data. The following symbolic values are accepted: GL_UNSIGNED_BYTE​, GL_BYTE​, GL_UNSIGNED_SHORT​, GL_SHORT​, GL_UNSIGNED_INT​, GL_INT​, GL_FLOAT​, GL_UNSIGNED_BYTE_3_3_2​, GL_UNSIGNED_BYTE_2_3_3_REV​, GL_UNSIGNED_SHORT_5_6_5​, GL_UNSIGNED_SHORT_5_6_5_REV​, GL_UNSIGNED_SHORT_4_4_4_4​, GL_UNSIGNED_SHORT_4_4_4_4_REV​, GL_UNSIGNED_SHORT_5_5_5_1​, GL_UNSIGNED_SHORT_1_5_5_5_REV​, GL_UNSIGNED_INT_8_8_8_8​, GL_UNSIGNED_INT_8_8_8_8_REV​, GL_UNSIGNED_INT_10_10_10_2​, and GL_UNSIGNED_INT_2_10_10_10_REV​.
data UnmanagedArrayBase Specifies a pointer to a single pixel of data to upload. This parameter may not be null.
autoBind bool Automatically call glBindBuffer() inside this method.
return bool

Create() public static method

Creates a sub-type of Buffer object directly in server side(GPU) without initializing its value.
public static Create ( IndependentBufferTarget target, Type elementType, int length, BufferUsage usage ) : Buffer
target IndependentBufferTarget
elementType System.Type
length int
usage BufferUsage
return Buffer

Create() public static method

Creates a OneIndexBuffer object directly in server side(GPU) without initializing its value.
public static Create ( IndexBufferElementType type, int length, DrawMode mode, BufferUsage usage ) : OneIndexBuffer
type IndexBufferElementType
length int How many indexes are there?(How many uint/ushort/bytes?)
mode DrawMode
usage BufferUsage
return OneIndexBuffer

Create() public static method

Creates a VertexBuffer object(actually an array) directly in server side(GPU) without initializing its value.
public static Create ( Type elementType, int length, VBOConfig config, string varNameInVertexShader, BufferUsage usage, uint instanceDivisor, int patchVertexes ) : VertexBuffer
elementType System.Type element's type of this 'array'.
length int How many elements are there?
config VBOConfig mapping to vertex shader's 'in' type.
varNameInVertexShader string mapping to vertex shader's 'in' name.
usage BufferUsage
instanceDivisor uint
patchVertexes int
return VertexBuffer

Create() public static method

Creates a ZeroIndexBuffer object directly in server side(GPU) without initializing its value.
public static Create ( DrawMode mode, int firstVertex, int vertexCount, int primCount = 1 ) : ZeroIndexBuffer
mode DrawMode
firstVertex int
vertexCount int
primCount int
return ZeroIndexBuffer

Dispose() public method

public Dispose ( ) : void
return void

DisposeManagedResources() protected method

protected DisposeManagedResources ( ) : void
return void

DisposeUnmanagedResources() protected method

protected DisposeUnmanagedResources ( ) : void
return void

DumpBufferTexture() public method

Dump a Texture filled with this Buffer.
public DumpBufferTexture ( uint internalFormat, bool autoDispose ) : Texture
internalFormat uint
autoDispose bool Dispose this buffer when disposing returned texture.
return Texture

MapBuffer() public method

Start to read/write buffer.
public MapBuffer ( MapBufferAccess access, bool bind = true ) : IntPtr
access MapBufferAccess
bind bool
return IntPtr

MapBufferRange() public method

Start to read/write buffer.
public MapBufferRange ( int offset, int length, MapBufferRangeAccess access, bool bind = true ) : IntPtr
offset int
length int
access MapBufferRangeAccess
bind bool
return IntPtr

Unbind() public method

Unind this buffer.
public Unbind ( ) : void
return void

UnmapBuffer() public method

Stop reading/writing buffer.
public UnmapBuffer ( bool unbind = true ) : bool
unbind bool
return bool