Microsoft DirectX 9.0

IDirect3DVertexDeclaration9::GetDeclaration Method

Gets the vertex shader declaration.


HRESULT GetDeclaration(      

    D3DVERTEXELEMENT9* pDecl,     UINT* pNumElements );


[in, out] Array of vertex elements that make up a vertex shader declaration. The application needs to allocate enough room for this. The vertex element array ends with the D3DDECL_END macro.
[in, out] Number of elements in the array. The application needs to allocate enough room for this.

Return Value

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value can be:

D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.


The number of elements, pNumElements, includes the D3DDECL_END macro, which ends the declaration. So the element count is actually one higher than the number of valid vertex elements.

Here's an example that will return the vertex declaration array of up to 256 elements.

// assumes a valid pointer to a vertex declaration object
UINT numElements;
HRESULT hr = m_pVertexDeclaration->GetDeclaration( decl, &numElements);

© 2002 Microsoft Corporation. All rights reserved.