Sign in to follow this  
-justin-

transparency with LPD3DXSPRITE not workin'

Recommended Posts

Guest Anonymous Poster
well depends, are you trying to completely make a certain color not show or the whole image opaque? check the DX sdk and look on the reference for ID3DXSPRITE and one of the options should be in the load function for the interface the other should be in the draw function of it, sry i dont have alot of time on my hands right now :P

Share this post


Link to post
Share on other sites
I've had problems with bitmaps and transparency in the past, transparency is handled oddly with bmps. Switch to .png! It's vastly superior to .bmp, and I have not had any problems with transparency using the format. I assume you're using the D3DX functions for loading the texture so you don't even have to change any code besides the filename.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
ya i agree if you can learn how to use png's you should use them, almost the same quality as bmp's but alot smaller, you SHOULD stay away from jpg's because they use a trick to fool your eye that it looks like it, google it cause i forgot the article, and in games especially when your working with 3d transformations, jpg's start kamikazeeing the program :|

Share this post


Link to post
Share on other sites
ok i'm using png's now and i remembered how to do transparent images... i did them before but forgot... u have to do the D3DXCreateTextureFromFileEx... or the more advanced format of it, that has a Colorkey value...

just in case any1 needed that :-)

Share this post


Link to post
Share on other sites
Quote:
Original post by -justin-
ok i'm using png's now and i remembered how to do transparent images... i did them before but forgot... u have to do the D3DXCreateTextureFromFileEx... or the more advanced format of it, that has a Colorkey value...

just in case any1 needed that :-)


Colorkeys are outdated. Use png! It has built in transparency! Yaarr!

Share this post


Link to post
Share on other sites
Quote:
Original post by load_bitmap_file
Quote:
Original post by -justin-
ok i'm using png's now and i remembered how to do transparent images... i did them before but forgot... u have to do the D3DXCreateTextureFromFileEx... or the more advanced format of it, that has a Colorkey value...

just in case any1 needed that :-)


Colorkeys are outdated. Use png! It has built in transparency! Yaarr!


if u could provide a working example of how to use this i would be happier :P

Share this post


Link to post
Share on other sites
i know i know, it's not good to bump topics... but seriously i could use some help (if no one replies after this i'll give up)

i need to make the black in my images transparent...

Share this post


Link to post
Share on other sites
Quote:
Original post by -justin-
Quote:
Original post by load_bitmap_file
Quote:
Original post by -justin-
ok i'm using png's now and i remembered how to do transparent images... i did them before but forgot... u have to do the D3DXCreateTextureFromFileEx... or the more advanced format of it, that has a Colorkey value...

just in case any1 needed that :-)


Colorkeys are outdated. Use png! It has built in transparency! Yaarr!


if u could provide a working example of how to use this i would be happier :P


I sort of did already :P First, take your .bmp image and convert it to .png. Make sure that your background/parts you want transparent are transparent. Meaning in paint the eraser tool usually works if you don't mess with the background color or in Photoshop you can select parts of a layer and delete them, leaving behind nothing (transparency). Once you have your fresh new .png image with the transparency stored inside the file itself, just load it as you had loaded your .bmp before, meaning use D3DXCreateTextureFromFile(). (Note that it's not the Ex version since we don't need/want the Colorkey). Now, begin drawing with ID3DXSprite->Begin(D3DXSPRITE_ALPHABLEND) like you already have, and then draw the texture with ID3DXSprite::Draw() like you already are (I assume). Your transparency should automagically kick in. Weee! A lot better than a colokey isn't it?

Note: If you're using Paint, I had problems sometimes with setting the background of images to white instead of transparent. I think if you don't change the background color then the "white" background is actually "transparent". Photoshop's sytem where the gray/white checkerboard means transparent is a lot better.

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