C3DMesh::LockVertexBuffer

Top  Previous  Next

Syntax:

 

LockVertexBuffer(), pointer

 

Purpose:

Locks the vertex buffer for direct reading/writing.

 

Parameters:

None.

 

Returned value(s):

A pointer to the vertex buffer memory.

 

Application:

POINTER pVB
pVB = *<C3DMesh>pRet.LockVertexBuffer()
#<VERTEX0TEXTURE>pVB.position.x = -x
#<VERTEX0TEXTURE>pVB.position.y = -y
#<VERTEX0TEXTURE>pVB.position.z = z
#<VERTEX0TEXTURE>pVB.diffuseColor = RGBA(255,0,0,255)
#<VERTEX0TEXTURE>pVB.normal = Vec3Normalize(#<VERTEX0TEXTURE>pVB.position)
*<C3DMesh>pRet.UnlockVertexBuffer()

 

Class Hierarchy

C3DObject

-------C3DMesh

 

Additional Info:

The pointer returned points to an array of UDT's matching the flexible vertex format used when the mesh was loaded or created. The pointer will be NULL if the mesh hasn't been allocated yet by loading from a file or creating with the CreateMesh or CreateMeshEx methods.

 

When working with vertex buffers, you are allowed to make multiple lock calls. However, you must ensure that the number of lock calls match the number of unlock calls.

 

Be sure the buffer is unlocked before trying to render the mesh.

 

See Also:

UnlockVertexBuffer