Vertex Declaration

rifter1818

Junior Contributor
Joined
Sep 11, 2003
Messages
255
Location
A cold dark place
With Vertex Declaration If i want the Position and texture Coordinants only,
Dim PT() As VertexElement = {New VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0), _
New VertexElement(0, 12, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0), VertexElement.VertexDeclarationEnd}
PositionTexture.VDec = New VertexDeclaration(D3d.Device, PT)
If I want to Pass a Vertex Buffer thats got Position NOrmal And Texture Elements to the vertex Shader do i need to create a new Declaration?
if i pass a position only Vertex buffer?
 
You'll have to create a new vertex declaration as the presence of normal will change the offset of the texture information from 12 to 24. The same for position only (here you don't even have en element for texture coordinates).
 
Back
Top