B
Bonghi
Hi all,
I have a problem initializing an array of custom structures.
It all occurs trying to visualize solids in XNA (ie new version of
managed directx) but I think the problem resides in something I do
wrong in c#. I really hope not to be off topic, furthermore I'm not a
frequent reader of this newsgroup.
Let's get to the point.
Everything works if I initialize the array in the form:
_Rendervertices = new VertexPositionColoredNormal[ { value1, value2,
value3 };
whereas if I initialize it like this:
_Rendervertices = new VertexPositionColoredNormal[3];
_Rendervertices[0] = value1;
_Rendervertices[1] = value2;
_Rendervertices[2] = value2;
I have problems when using the array to fill a vertexbuffer
I believe vertexbuffers read the memory offsets of specified
information and in fact the structure is defined with an attribute
[StructLayout(LayoutKind.Sequential)] should the array be defined with
some similar attribute as well?
I'm really lost with this. I thought the two methods would result in
the same memory allocation.
Many thanks for any hint you could provide.
Claudio
I have a problem initializing an array of custom structures.
It all occurs trying to visualize solids in XNA (ie new version of
managed directx) but I think the problem resides in something I do
wrong in c#. I really hope not to be off topic, furthermore I'm not a
frequent reader of this newsgroup.
Let's get to the point.
Everything works if I initialize the array in the form:
_Rendervertices = new VertexPositionColoredNormal[ { value1, value2,
value3 };
whereas if I initialize it like this:
_Rendervertices = new VertexPositionColoredNormal[3];
_Rendervertices[0] = value1;
_Rendervertices[1] = value2;
_Rendervertices[2] = value2;
I have problems when using the array to fill a vertexbuffer
I believe vertexbuffers read the memory offsets of specified
information and in fact the structure is defined with an attribute
[StructLayout(LayoutKind.Sequential)] should the array be defined with
some similar attribute as well?
I'm really lost with this. I thought the two methods would result in
the same memory allocation.
Many thanks for any hint you could provide.
Claudio