Advertisement Jump to content
Sign in to follow this  

a question about d3d display ,for help

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

Now ,I have a problem with d3d programming.I want to use d3d to display a image on the screeen.Although I have set the colorkey as 0xffff00ff, but the image is always in black box.
My code is as the following:

//set the render state


//create a surface and load the image

HRESULT hResult=D3DXGetImageInfoFromFile(imageFile,&imageInfo);
return NULL;

return NULL;
imageFile,NULL,D3DX_DEFAULT,colorKey,NULL); //i have sat the colorkey as 0xffff00ff

i know that i can use another metohd to display this image ,such as IDXSprite,but i always want to know why my code doesnt work .
where is woring or the StretchRect function doesnt support the transprarency color ? anybody can help me?Thanks!

Share this post

Link to post
Share on other sites

StretchRect() does a simple texture copy and ignores the alpha channel. You probably want to use ID3DXSprite to draw your image.

Thank you very much!I have considered it but not for sure.I just want to use a simple method and i think DirectDraw was in my mind.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!