Jump to content
  • Advertisement
Sign in to follow this  
Grantyt3

Sprite Opacity

This topic is 4494 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!