# [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 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 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);