transparency with LPD3DXSPRITE not workin'

Started by
9 comments, last by -justin- 18 years, 10 months ago
not getting this, i set the render state to allow alpha blending i did my Sprite->Begin(D3DXSPRITE_ALPHABLEND); what am i missing? my images are in bmp format...
Advertisement
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
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.
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 :|
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 :-)
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!

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
can any1 help me?

my images look horrible since transparancy with colorkeys isn't workin too well
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...
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.

This topic is closed to new replies.

Advertisement