VertexBuffer.VertexBuffer(IntPtr) Constructor (Microsoft.DirectX.Direct3D)
Creates a new instance of the VertexBuffer class.
Definition
Visual Basic Public Sub New( _
ByVal unmanagedObject As IntPtr _
)C# public VertexBuffer(
IntPtr unmanagedObject
);C++ public:
VertexBuffer(
IntPtr unmanagedObject
);JScript public function VertexBuffer(
unmanagedObject : IntPtr
);
Parameters
unmanagedObject System.IntPtr
Pointer to an unmanaged Component Object Model (COM) IDirect3DVertexBuffer9 interface. This parameter is useful for working with unmanaged applications from managed code. Not supported.
Remarks
A vertex buffer can be used with either hardware or software vertex processing. The type of processing is determined by the way the device and the vertex buffer are created.
When a device is created, the Device constructor uses the behavior flag to determine whether to process vertices in hardware or software. The options are:
- Process vertices in hardware by setting HardwareVertexProcessing.
- Process vertices in software by setting SoftwareVertexProcessing.
- Process vertices in either hardware or software by setting MixedVertexProcessing.
After the device is created, mixed-mode devices might need to switch between software and hardware processing (using Device.SoftwareVertexProcessing).
When a vertex buffer is created, the VertexBuffer constructor uses the param_Usage_usage parameter to determine whether to process vertices in hardware or software. The following rules apply.
- If the Device constructor uses HardwareVertexProcessing, the VertexBuffer constructor must use 0.
- If the Device constructor uses SoftwareVertexProcessing, the VertexBuffer constructor must use either 0 or SoftwareVertexProcessing. For either value, vertices are processed in software.
- If the Device constructor uses MixedVertexProcessing, the VertexBuffer constructor can use either 0 or SoftwareVertexProcessing.
To use a vertex buffer with a mixed-mode device, create one that can be used for both hardware and software processing. Use Device.SetStreamSource to set the current vertex buffer and Device.RenderState, if necessary, to change the device behavior to match. It is recommended that the vertex buffer usage match the device behavior. Note that a vertex buffer created for software processing cannot be located in video memory.
The Device object supports rendering of primitives using vertex data stored in vertex buffer objects. Vertex buffers are created from the Device, and are usable only with the Device object from which they are created.
Those VertexBuffer constructors that are created with the param_VertexFormats_vertexFormat parameter set to 0 can be used to interleave data during multipass or multitexture rendering in a single pass. To do this, one buffer contains geometry data and the others contain texture coordinates for each texture to render. When rendering, the buffer that contains the geometry data is interleaved with each of the buffers that contain the texture coordinates. If the param_VertexFormats_vertexFormat parameter is set to a non-zero value, each buffer must contain identical geometry data in addition to the texture coordinate data specific to each rendered texture. This results in either a speed or memory penalty, depending on the strategy used.
Exceptions
The method call is invalid. For example, a method's parameter might contain an invalid value.
Microsoft Direct3D does not have enough display memory to perform the operation.
Direct3D could not allocate sufficient memory to complete the call.
See Also