• Advertisement

Archived

This topic is now archived and is closed to further replies.

DX9 PointSprite Size problems

This topic is 5061 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

I am trying to update my particle engine to use point sprite sizes within the vertices themselves so they can change size over time. My Particle struct looks like this: private struct ParticleVertex {
public Vector3 v; public float size; public int color; public static readonly VertexFormats Format = VertexFormats.Position | VertexFormats.Diffuse | VertexFormats.PointSize; }; When I render the particles as usual they are tiny 1 pixel things and the number I store for the size actually ends up changing their colors. Can anyone tell me what I am missing? -------------------------------------------------------------------------- The meaning of life is to live, and there's only one way to do it wrong... Michael Schuld - March 25, 2004 [edited by - mikeschuld on April 14, 2004 8:02:03 PM]

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
My experince is that DXPointSprites is only for very small sprites, just a few pixels. So if your texture is 64*64 then it won''t work.

Share this post


Link to post
Share on other sites
Okay, from my experience your problem lies in the fact that you declare it as having diffuse | size and you have first the float for size and only then the int for color.

If you swap either the diffuse | color OR swap the order of the float size with the int color, your done. Something like this:

private struct ParticleVertex {

public Vector3 v;
public int color; <- Swapped
public float size; <- Swapped

public static readonly VertexFormats Format = VertexFormats.Position | VertexFormats.Diffuse | VertexFormats.PointSize;
};


It actually puzzled me to no avail how could the compiler know what variable meant what in the vertex declaration, until i read somewhere order was important.

Hope this helps.

As for what the AP said, it is not true. I believe it is dependent on the hardware. You should check the device caps.

Joao Correia

Share this post


Link to post
Share on other sites
It is working now. I put them in the same order as they were before, but i changed a couple of render states to make them work. Thanks for the input guys.

[edited by - mikeschuld on April 15, 2004 9:21:26 PM]

Share this post


Link to post
Share on other sites

  • Advertisement