Partager via


VertexBuffer.Unlock Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Unlocks vertex data.

Namespace:  Microsoft.WindowsMobile.DirectX.Direct3D
Assembly:  Microsoft.WindowsMobile.DirectX (in Microsoft.WindowsMobile.DirectX.dll)

Syntax

'Declaration
Public Sub Unlock
'Usage
Dim instance As VertexBuffer

instance.Unlock()
public void Unlock()
public:
void Unlock()
member Unlock : unit -> unit 

Examples

The following example shows how to use the Unlock method.

' Create several meshes and associated data.
Dim i As Integer
For i = 0 To numberOfMeshes
    Dim vertexData As GraphicsStream

    meshes(i) = Mesh.Box(device, 1F, 1F, 1F)

    ' Arrange the boxes in a grid, with each
    ' successive box farther in the distance.
    meshLocations(i) = New Vector3((i Mod 3) * 2 - 2, i / 3 * 2 - 2, i)

    ' Compute the bounding box for a mesh.
    Dim description As VertexBufferDescription = meshes(i).VertexBuffer.Description
    vertexData = meshes(i).VertexBuffer.Lock(0, 0, LockFlags.ReadOnly)
    Geometry.ComputeBoundingBox(vertexData, meshes(i).NumberVertices, description.VertexFormat, meshBoundingBoxMinValues(i), meshBoundingBoxMaxValues(i))
    meshes(i).VertexBuffer.Unlock()
Next i
// Create several meshes and associated data.
for (int i = 0; i < numberOfMeshes; i++)
{
    GraphicsStream vertexData;

    meshes[i] = Mesh.Box(device, 1.0f, 1.0f, 1.0f);

    // Arrange the boxes in a grid, with each
    // successive box farther in the distance.
    meshLocations[i] = new Vector3(((i % 3) * 2) - 2,
                                ((i / 3) * 2) - 2, i);

    // Compute the bounding box for a mesh.
    VertexBufferDescription description =
        meshes[i].VertexBuffer.Description;
    vertexData = meshes[i].VertexBuffer.Lock
                             (0, 0, LockFlags.ReadOnly);
    Geometry.ComputeBoundingBox(vertexData,
        meshes[i].NumberVertices,description.VertexFormat,
        out meshBoundingBoxMinValues[i],
        out meshBoundingBoxMaxValues[i]);
    meshes[i].VertexBuffer.Unlock();
}

.NET Framework Security

Platforms

Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Compact Framework

Supported in: 3.5, 2.0

See Also

Reference

VertexBuffer Class

VertexBuffer Members

Microsoft.WindowsMobile.DirectX.Direct3D Namespace