Point sprites terminate the application

From: kordeul (kordeul_at_hotmail.com)
Date: 10/19/04


Date: Tue, 19 Oct 2004 12:56:27 +0200

Hello

I want to implement point sprite particle system. Looking at the DX9
documentation I have to use custom vertex format with position, size and
color. Now I couldn't find the desired struct in the CustomVertex class,
so I created a new one like:

public struct ParticleVertex
{
        public Vector3 Pos;
        public float Size;
        public int Color;
        public static readonly VertexFormats Format =
                VertexFormats.Position |
                VertexFormats.PointSize |
                VertexFormats.Diffuse;
}

Then I update and fill my VertexBuffer with the desired values to
generate particles at runtime. It all works - my particles act as I want
them to, but if I press a key or move the mouse, the application sooner
or later (randomly) exits without any message.

Commenting specific sections out, I found out the problem is locking the
vertex buffer at each iteration. The strange thing is that doing exactly
the same thing but using a "standard" vertex format from the
CustomVertex class works!

The conclusion I came to is the problem is somewhere inside my custom
ParticleVertex struct. I tried several changes, but the result is the
always same.

Any clues would be greatly appreaciated.

Tom