🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Textures With Color Keys?

Started by
3 comments, last by Ranok 24 years, 8 months ago
yes you can. the render state is D3DRENDERSTATE_COLORKEYENABLE, set that to true. when you create the textures, you have to add the DDSD_CKSRCBLT flag to DDSURFACEDESC2.dwFlags and fill out the ddckCKSrcBlt structure. the documentation says it won't work if you don't add that flag on creation, you can't set it later. also, the colors in the ddckCKSrcBlt structure have to match the pixel format, i didn't know that and spent a lot of time trying to figure out why it wouldn't work.

one problem i had was when i enabled linear texture filtering. the transparency color was (0,255,255), turqouise, but when everything gets larger the turqouise mixes in with the other colors so i get turquoise mixed with other color borders. does anyone know how to fix that?

------------------
http://members.xoom.com/mutex0


Advertisement
Does anybody know if you can do alpha blending and color keying at the same time?
---Ranok---
I'd avoid using color keying for the reason described above. Instead, use Alpha Blending plus Alpha Testing. Alpha testing checks to see if a pixel is completely transparent and throws it out if it is -- basically color keying. So you'd basically be using blending and colorkeying together .

--TheGoop

Does anybody know if you can do color keying with DirectX Textures in IM and if you can how do you do it?
---Ranok---
I want to load a bitmap that has an alpha channel that says where it is totally transparent, where it is partially transparent, and where it is totally opaque. Can anybody tell me how to do this?
---Ranok---

This topic is closed to new replies.

Advertisement