SoGpuBufferObject Class |
GPU buffer object class.
Namespace: OIV.Inventor.Devices
The SoGpuBufferObject type exposes the following members.
Name | Description | |
---|---|---|
SoGpuBufferObject | Calls SoGpuBufferObject(OIV.Inventor.Devices.SoGpuBufferObject.BufferAccessFrequencies( .SoGpuBufferObject.STATIC ), OIV.Inventor.Devices.SoGpuBufferObject.BufferAccessNatures( .SoGpuBufferObject.SHARED )). | |
SoGpuBufferObject(SoGpuBufferObjectBufferAccessFrequencies) | Calls SoGpuBufferObject(accessFrequency, OIV.Inventor.Devices.SoGpuBufferObject.BufferAccessNatures( .SoGpuBufferObject.SHARED )). | |
SoGpuBufferObject(SoGpuBufferObjectBufferAccessFrequencies, SoGpuBufferObjectBufferAccessNatures) | Constructor. |
Name | Description | |
---|---|---|
ClearInstance | This function clears the content of the buffer, it frees the memory if the mode was COPY. | |
CreateInstance | Create a new buffer with the same properties as the current one. | |
Dispose |
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.) | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
FillT |
Convenient method to fill an SoBufferObject with
a default value.
(Inherited from SoBufferObject.) | |
GetAccessFrequency | Returns the current buffer access frequency hint for this buffer object. | |
GetAccessNature | Returns the current buffer access nature hint for this buffer object. | |
GetContext | Returns the device context where this buffer is valid. | |
GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) | |
GetMappedBufferObject | Returns a pointer to the buffer object which is mapped by the actual object. | |
GetMappedBufferObjectAccessMode | Returns the access mode used for the buffer mapping. | |
GetMappedBufferObjectPosition | Returns the position in the source buffer mapped in this buffer. | |
GetMappedBufferObjectSize | Returns the size of the mapped area in bytes. | |
GetSize | Returns the size, in bytes, of the buffer object. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
LockBuffer | Locks the buffer against concurrent calls from different threads. | |
Map(SoBufferObjectAccessModes) | Calls Map(accessMode, System.UInt64(0), System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)). (Inherited from SoBufferObject.) | |
Map(SoBufferObject, SoBufferObjectAccessModes) | Calls Map(targetBufferObject, accessMode, System.UInt64(0), System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)). (Inherited from SoBufferObject.) | |
Map(SoBufferObjectAccessModes, UInt64) | Calls Map(accessMode, offset, System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)). (Inherited from SoBufferObject.) | |
Map(SoBufferObject, SoBufferObjectAccessModes, UInt64) | Calls Map(targetBufferObject, accessMode, startPosition, System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)). (Inherited from SoBufferObject.) | |
Map(SoBufferObjectAccessModes, UInt64, UInt64) | Map the buffer to a system memory address and allows the mapping of a sub part of the buffer object into CPU memory. | |
Map(SoBufferObject, SoBufferObjectAccessModes, UInt64, UInt64) | Maps the current buffer object into the specified buffer object. | |
Memcpy(SoBufferObject) | Calls Memcpy(sourceBufferObject, System.UInt64(0), System.UInt64(0), System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)). (Inherited from SoBufferObject.) | |
Memcpy(SoBufferObject, UInt64) | Calls Memcpy(sourceBufferObject, destOffset, System.UInt64(0), System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)). (Inherited from SoBufferObject.) | |
Memcpy(SoBufferObject, UInt64, UInt64) | Calls Memcpy(sourceBufferObject, destOffset, sourceOffset, System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)). (Inherited from SoBufferObject.) | |
Memcpy(SoBufferObject, UInt64, UInt64, UInt64) | Copies data from the specified buffer object into this buffer object. | |
Memset(IntPtr) | Calls Memset(value, System.Convert.ToUInt64(1), System.UInt64(0), System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)). (Inherited from SoBufferObject.) | |
Memset(IntPtr, UInt64) | Calls Memset(value, valueSize, System.UInt64(0), System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)). (Inherited from SoBufferObject.) | |
Memset(IntPtr, UInt64, UInt64) | Calls Memset(value, valueSize, offset, System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)). (Inherited from SoBufferObject.) | |
Memset(IntPtr, UInt64, UInt64, UInt64) | This function sets the contents of (or a portion of) this buffer object to the specified value. | |
SetSize | Sets the size in bytes of the buffer object. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
UnlockBuffer | Unlocks the buffer object. | |
Unmap | Unmaps the buffer from CPU address space. | |
Unmap(SoBufferObject) | Unmap this buffer from the specified buffer object. |
Name | Description | |
---|---|---|
IsDisposable | ISafeDisposable interface implementation.
(Inherited from SoDisposable.) |
This class provides management functions for GPU memory buffers.
Note: Since Open Inventor 10.4, applications should use SoGPUBufferObject, instead of OIV.Inventor.Devices.SoGLBufferObject, in most cases. For example to store vertex data in GPU memory for use with OIV.Inventor.Nodes.SoBufferedShape or OIV.Inventor.Nodes.SoVertexShaderParameterBufferObject.
See OIV.Inventor.Devices.SoBufferObject for general information about buffer objects.
NOTES:
Creating a GPU buffer requires a current GPU context (like OpenGL).
Modifying the properties of an GPU buffer require a current GPU context. This includes mapping and unmapping the buffer (OIV.Inventor.Devices.SoBufferObject.Map(OIV.Inventor.Devices.SoBufferObject.AccessModes, System.UInt64, System.UInt64)/unmap()), allocating memory (OIV.Inventor.Devices.SoGpuBufferObject.SetSize(System.UInt64)) and copying data into the buffer (e.g. OIV.Inventor.Devices.SoBufferObject.Memcpy(OIV.Inventor.Devices.SoBufferObject, System.UInt64, System.UInt64, System.UInt64)).
The same instance of OIV.Inventor.Devices.SoGpuBufferObject can not be used inside two GPU contexts that are not shared. For example, if an instance of OIV.Inventor.Nodes.SoBufferedShape contains SoGpuBufferObjects in its fields, this instance can be used in multiple viewers only if their contexts are shared.
See OIV.Inventor.Devices.SoBufferObject for general information about buffer objects.
See OIV.Inventor.Nodes.SoBufferedShape for an example of storing vertices in a GPU buffer.
Load data into a buffer object.
Create a GPU buffer object and load data from an array in memory:
float[] vertices = new float[9 * 3] { 1.0f, 0.5f,0.0f, 0.0f, 1.0f,0.0f, -1.0f,0.5f,0.0f, -1.0f,-1.0f,0.0f, 1.0f,-1.0f,0.0f, 1.0f,0.0f,0.0f, -1.0f,0.0f,0.0f, -1.0f,-1.5f,0.0f, 1.0f,-1.5f,0.0f }; SbNativeArray<float> vertArray = new SbNativeArray<float>(vertices); SoCpuBufferObject vertBuf = new SoCpuBufferObject( (SbNativeArray<byte>)vertArray ); SoGpuBufferObject gpuBuffer = new SoGpuBufferObject( SoGpuBufferObject.BufferAccessFrequencies.STATIC, SoGpuBufferObject.BufferAccessNatures.SHARED ); gpuBuffer.SetSize( cpuBuffer.GetSize() ); // Set the buffer size (allocate memory) gpuBuffer.Memcpy ( cpuBuffer ); // Copy data into the buffer
Access data stored in a GPU buffer object.
SbNativeArray<float> data = (SbNativeArray<float>)gpuBuffer.Map( SoBufferObject.AccessModes.READ_ONLY ); float value = data[0]; value = data[1]; . . . gpuBuffer.Unmap();