Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

beginner_directx

D3DXSprite

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

Advertisement
From what i''ve learned you need to set your transparancy color to that pink so that when you use something like blit to blit the image to the backbuffer it won''t copy over the pink. I''ve only just started learning directx 6.0 from lamonths books but he uses a function called color key and sets up that color so it doesn''t draw. Try searching the forums on those key words.

Share this post


Link to post
Share on other sites
If you use the built-in CreateTexture functions, one of the arguments is a color key. Just make a color key struct, like so:

D3DCOLOR colorkey = 0xFF000000; //This is opaque black

and use colorkey as the argument.

Share this post


Link to post
Share on other sites
thanx(&GimpMaster , &Forcas);
Forcas , it worked .
I have another question
If I want to render fire effect for example , I want the fire to be blended not solid . I hope you understand what i mean .

thanx again GimpMaster and Forcas

Share this post


Link to post
Share on other sites
1- if u use direct draw u should set the transparenc colour
by draw the background with black and set the tranparence with 0
2- if u use d3d u should use D3d Colour key


3-u should use Particular effect
to make some effect such as water , smoke , rain etc..
by make a function that draw pixel, etc...
do it for ur self

AhmedSaleh
EGYPT

Share this post


Link to post
Share on other sites
Alright.... to modulate the alpha channel(translation: make stuff translucent), you need to set the last argument of the draw function to D3DCOLOR_ARGB(translucency, 0, 0, 0);

Where translucency is a const int from anywhere between 0 (100% transparent, to 255 100% solid)

Share this post


Link to post
Share on other sites
When I use D3DXCreateTextureFromFileEx to make the pink in my texture tranparent, it seem to be replaced with the non-transparent black from my mesh (a rectangle made from two triangles)? How can I get this to be transparent?

My transparent color is (some form of pink):

R=255
G=0
B=255
O=100%


The following are the color keys that I have tried (Not sure if 100% is FF):

0xC8FF00FF
0xC7FF00FF
0xFFFF00FF
0x00FF00FF

hr = D3DXCreateTextureFromFileEx(pd3dDevice,
pCursorFile,
0,0,
D3DX_DEFAULT,
D3DPOOL_DEFAULT,
D3DFMT_UNKNOWN,
D3DPOOL_DEFAULT,
D3DX_FILTER_NONE,
D3DX_FILTER_NONE,
0xC8FF00FF,
NULL,
NULL,
&m_pCursorTex);

Share this post


Link to post
Share on other sites
You''d have to lock the texture, and then use an algorithm to write your pixels directly to it.

Or you could find an art program that can set the alpha level of every pixel, but I''ve never seen one of those.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!