• Advertisement
Sign in to follow this  

Multiple Streams ?

This topic is 4803 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! Well, I have been testing using multiple streams with DX9. My question is if the VertexElements need to be created in a certain order? cuz it seems like when I switch the Normal and Color element, the application crashes upon the DrawPrimitive call: elements[0] = new VertexElement(0, 0, D3D.DeclarationType.Float3, D3D.DeclarationMethod.Default, D3D.DeclarationUsage.Position, 0); elements[1] = new VertexElement(0, 12, D3D.DeclarationType.Float3, D3D.DeclarationMethod.Default, D3D.DeclarationUsage.Normal, 0); elements[2] = new VertexElement(1, 0, D3D.DeclarationType.Color, D3D.DeclarationMethod.Default, D3D.DeclarationUsage.Color, 0); elements[3] = D3D.VertexElement.VertexDeclarationEnd; The above is OK! VertexElement[] elements = new VertexElement[4]; elements[0] = new VertexElement(0, 0, D3D.DeclarationType.Float3, D3D.DeclarationMethod.Default, D3D.DeclarationUsage.Position, 0); elements[1] = new VertexElement(1, 0, D3D.DeclarationType.Color, D3D.DeclarationMethod.Default, D3D.DeclarationUsage.Color, 0); elements[2] = new VertexElement(0, 12, D3D.DeclarationType.Float3, D3D.DeclarationMethod.Default, D3D.DeclarationUsage.Normal, 0); elements[3] = D3D.VertexElement.VertexDeclarationEnd; The last one crashes the application :( I still do point out which offset the element is in and in which stream. Is it supposed to crash when the elements aren't in a certain order or is it just my application? Stream 0: CustomVertex.PositionNormal Stream 1: int thx!

Share this post


Link to post
Share on other sites
Advertisement
Hi,

I suppose the CreateVertexDeclaration() call failed, returning a Null declaration. So then DrawPrimitive() can crash because it is expecting that a valid vertex declaration was set.

I think you must set all the elements from stream 0, then all those from stream 1, and so on. I haven't seen anything about it in the doc, but all samples are doing it like that..

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement