VertexBuffer.VertexBuffer Constructor

Language:

Creates a new instance of the VertexBuffer class.

Definition

Visual Basic Public Sub New( _
    ByVal pInterop As IDirect3DVertexBuffer9 _
)
C# public VertexBuffer(
    IDirect3DVertexBuffer9 pInterop
);
C++ public:
 VertexBuffer(
    IDirect3DVertexBuffer9 pInterop
);
JScript public function VertexBuffer(
    pInterop : IDirect3DVertexBuffer9
);

Parameters

pInterop Microsoft.DirectX.PrivateImplementationDetails.IDirect3DVertexBuffer9
Unmanaged Component Object Model (COM) IDirect3DVertexBuffer9 interface pointer.

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:

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.

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
InvalidCallException The method call is invalid. For example, a method's parameter might contain an invalid value.
OutOfVideoMemoryException Microsoft Direct3D does not have enough display memory to perform the operation.
OutOfMemoryException Leave Site Direct3D could not allocate sufficient memory to complete the call.

See Also


Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center