ah yes, I realized that later, I only used 0 and elements*stride as an offset in the actual code for the first parameter.
Either way,
vertexBuffer.SetData(0, vertices, 0, 4, stride);
doesn’t work for me either, is it possible that i somehow got my bytesize wrong?
public struct TrailVertex
{
// Stores the starting position of the particle.
public Vector3 Position;
// Stores TexCoords
public Vector2 TextureCoordinate;
// Visibility term
public float Visibility;
public static readonly VertexDeclaration VertexDeclaration = new VertexDeclaration
(
new VertexElement(0, VertexElementFormat.Vector3,
VertexElementUsage.Position, 0),
new VertexElement(sizeof(float) * 3, VertexElementFormat.Vector2,
VertexElementUsage.TextureCoordinate, 0),
new VertexElement(sizeof(float) * 3 + sizeof(float) * 2, VertexElementFormat.Single,
VertexElementUsage.TextureCoordinate, 1)
);
public const int SizeInBytes = sizeof(float)*6; //24
}
plus later on in the implementation
int stride = TrailVertex.SizeInBytes;
_vBuffer.SetData(0,vertices,0,4,stride,SetDataOptions.None);
or
_vBuffer.SetData(stride*4,vertices,4,4,stride,SetDataOptions.None);
both have heavy artifacts, so I guess it must be the stride size right?