Sign in to follow this  

Sprite Opacity

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

If I have a sprite object from the sprite class, can it's opacity be changed, or would it have to be a textured 3D quad for that? I know you can also just use an algorithm to blend the sprite with it's background, but that's kind of a hassle.

Share this post


Link to post
Share on other sites
I assume when you say sprite class you are referring to ID3DXSprite.

When you specify a colour when you draw a quad your first value 0xXXFFFFFF (XX) is your alpha component.

If that doesn't work enable pass "D3DXSPRITE_ALPHABLEND" as a flag when you use sprite->begin(flag) then try the stuff above again.

Share this post


Link to post
Share on other sites

RECT srcrect;
srcrect.top=0;
srcrect.left=0;
srcrect.right=800;
srcrect.bottom=50;
hudsprite->Draw(hud,&srcrect,NULL,NULL,NULL,&D3DXVECTOR2(0,548.0),D3DCOLOR_ARGB(200,255,255,255));



This is what I do. The last argument, D3DCOLOR_ARGB(200,255,255,255) means the alpha channel is 200, which means it is partially transparant. The other channels are pumped out at their total amount (255)

Hope that helps!

Share this post


Link to post
Share on other sites

This topic is 4276 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.

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