• Advertisement
Sign in to follow this  

D3d Sprite color keys

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

Hi, I am having some trouble. I am using MS Paint to add hot pink to textures (255,0,255) to places I want to be see through, and it has always worked except for Sprites. For the sprite (used for the GUI) I load it via:
	D3DXCreateTextureFromFileEx(d3ddev,
                            "bottombase.png",
                            SCREEN_WIDTH,
                            SCREEN_HEIGHT / 5.0f,
                            D3DX_DEFAULT,
                            NULL,
                            D3DFMT_A8R8G8B8,
                            D3DPOOL_MANAGED,
                            D3DX_DEFAULT,
                            D3DX_DEFAULT,
                            D3DCOLOR_XRGB(255, 0, 255),    // the hot-pink color key
                            NULL,
                            NULL,
                            &guiBotBase);

and render it via:
d3dspt->Begin(D3DXSPRITE_ALPHABLEND);

		D3DXVECTOR3 center(0.0f, 0.0f, 0.0f);
		D3DXVECTOR3 position(0.0f, 1 + (4.0f / 5.0f * SCREEN_HEIGHT), 0.0f);
		d3dspt->Draw(guiBotBase, NULL, ¢er, &position, D3DCOLOR_ARGB(guiAlpha, 127, 127, 127));

	d3dspt->End();
where GUI alpha is the alpha blend rate (I have it set so it will become more opaque when you hover over it). I think it has something to do with drawing it, and drawing it with full colors (255, 255, 255) or (0,0,0) doesnt work. The only color it works for is black, and I think thats because when its drawn any darker it wont matter. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Is Pix the code word for picture or is there a hidden meaning to it? I'm pretty new to a lot of graphical stuff, sorry:(

Could it be that the 255,0,255 is getting drawn as a diff. color?

Share this post


Link to post
Share on other sites
PIX is a tool in the DirectX SDK; you can use it to debug Direct3D graphics code. Find it in your start menu, choose "Single frame capture whenever F12 is pressed," and point it at your .EXE file. (If your program can't find its files, you may need to fix the working directory as well). Hit F12 once your program is running and you should get a nice list of all the draw calls your program is making, so you can start analysing what's going wrong.

Share this post


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

  • Advertisement