Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

D3D9 Pointsrpite example: No color?

HickoryHickory Member Posts: 56
I was trying out the Dx9 point sprite sample, and realised that, though the Render function sets up the vertice color value to the value of the particle, it actually has no effect. The point srpites color is 100% based on its texture, and isnt affected by the custom vertex type, which looks something like:

struct POINTVERTEX
{
D3DXVECTOR3 v;
D3DCOLOR color;
};

Does anyone know why? What can be done to this sample to make the color value have an effect? The ground plane is affected by its D3DCOLOR value, so why isnt the point sprite?

Comments

  • SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
    Off-hand you could try a more primitive function. I myself do GL, but when I started I looked at glut, and realized that you lost control over vertex colors in most of the glut functions. I stuck with plain GL and can easily color the vertices, which affects the texture color. I have yet to even think about DX9, but I'm sure there's a more primitive function in there that actually does the work, and if you find it and call it you can probably use the color value. I know several VERY talented DX coders on this forum and I'm sure one of them will reply to your post with detailed info or at least a link to get you on the right track.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • chick80chick80 Member Posts: 349
    [b][red]This message was edited by chick80 at 2003-5-26 12:38:25[/red][/b][hr]
    Well, I didn't inspect that sample very much... but I think the particle color is governed by the m_clrDiffuse member of the PARTICLE struct (defined just some lines below the FVF you referred).
    If you look at the CParticleSystem::Update and CParticleSystem::Render functions, you'll see that in the first m_clrDiffuse is modified, and faded when needed, and in the second function the vertex buffer used for rendering the particles is locked, and the color member of the POINTVERTEX struct is filled with the m_clrDiffuse value.
    So, if you change m_clrDiffuse (for example, in Update, forcing it to a particular D3DXCOLOR), you'll change the particle color!
    (Btw, you'll see the color change pressing F4 during the sample).

    nICO

    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS




Sign In or Register to comment.