Sign in to follow this  
Sol Blue

[Solved] Color parameter in ID3DXSprite::Draw() isn't applied in object space

Recommended Posts

Sol Blue    139
Hi all, I'm using ID3DXSprite in object space. The last parameter of its Draw() method is a D3DCOLOR, which is supposed to tint the drawn sprite. Back when I was using ID3DXSprite with pre-transformed coordinates, that worked fine, but now it is entirely ignoring that parameter. Even though I'm passing different colors in, it always draws as if it had gotten D3DCOLOR_XRGB(255, 255, 255). Now that I'm using ID3DXSprite with the D3DXSPRITE_OBJECTSPACE | D3DXSPRITE_DONOTMODIFY_RENDERSTATE flags, are there some render states or something that I need to manually set for it to pay attention to the color parameter again? Thanks for any help! If it would be helpful to know what render states I already have set, I can post those. [Edited by - Sol Blue on May 13, 2008 2:24:00 PM]

Share this post


Link to post
Share on other sites
MJP    19755
It's not the D3DXSPRITE_OBJECTSPACE parameter, it's the D3DXSPRITE_DONOTMODIFY_RENDERSTATE. ID3DXSprite normally sets texture stage stages that allow it to modulate the texture color by that color you supply.

You can see what render states, texture stage states, and sampler states ID3DXSprite normally sets right here.

Share this post


Link to post
Share on other sites
Sol Blue    139
Thanks MJP, that helped!

For others who might come along: the solution was to change the first line to the second --


gDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
gDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this