Jump to content
  • Advertisement
Sign in to follow this  
nlraley

Trying to draw a control over my already loaded background

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

I have loaded a bunch of sprites to create my background image. Now I would like to add another sprite to act as a navigation control on top of this; however, the transparency is showing up as a solid black color.

How would I get the navigation control sprite to load up and honor its tansparency, thus showing the originally loaded background in the transparency section of the navigation control?

I created the Texture with:
D3DXCreateTextureFromFileEx (
d3d9Device, // Device
navFile, // File Name/Location
0, // Width - 0 Indicates use Dimensions from File to a power of 2
0, // Height - 0 Indicates use Dimensions from File to a power of 2
0, // Mip Levels
0, // Render Targer
D3DFMT_A8R8G8B8, // D3D Format
D3DPOOL_MANAGED, // D3D Pool
D3DX_FILTER_NONE, // Image Filter
D3DX_DEFAULT, // Mip Filter
D3DCOLOR_XRGB(255, 0, 255), // the hot-pink color key
&navInfo, // Pointer to Image Information Structure to be Filled with Image Information
NULL, // Pallette Entry
&navTexture // Pointer to D3D9TEXTURE to hold the Texture
)))


And then was displaying it with:
hr = d3d9Sprite->Draw(
navTexture,
NULL,
new D3DXVECTOR3(0.0f, 0.0f, 0.0f),
new D3DXVECTOR3(0.0f, 0.0f, 0.0f),
D3DCOLOR_ARGB(127, 255, 255, 255)
);

Share this post


Link to post
Share on other sites
Advertisement
Are you sure your colour key is correct? Is it definitely RGB(255, 0, 255) in your image editor, and not being saved using a lossy format like JPEG?

Are you using the D3DXSPRITE_ALPHABLEND flag when calling ID3DXSprite::Begin()?

Share this post


Link to post
Share on other sites
Quote:
Original post by nlraley
Yea, that was it. Is there a way to set it so it doesn't have the faded out appearance?
Faded out appearance? I assume that your source image has an alpha channel in it, with the alpha channel set to 0.5 or something. If you use the alpha blend flag on an image with no alpha channel, then it will still display as completely opaque.

Share this post


Link to post
Share on other sites
Nevermind, setting the A value to 255 fixed it. Example is here:
hr = d3d9Sprite->Draw(
navTexture,
NULL,
new D3DXVECTOR3(0.0f, 0.0f, 0.0f),
new D3DXVECTOR3(0.0f, 0.0f, 0.0f),
D3DCOLOR_ARGB(127, 255, 255, 255)
);

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!