Sign in to follow this  

Fading textures - DirectX 9 c++

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

Hello, Would anyone know how to basically 'fade' a texture? In this instance, my app's background is white on initialization, and I am drawing a texture onto a vertex buffer which covers the window area of the app. All I want to do is fade the image I am rendering so basically the only thing that can be seen is the background. I've included a few standard code snipets below so as to highlight exactly how I am going about loading and rendering the texture at present. **InitDeviceObjects()** D3DXCreateTextureFromFileEx( m_pd3dDevice, "Resources\\Engine Standards\\Logo.jpg", 0, 0, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0xFF000000, NULL, NULL,&m_TextureLogo ) ) ) **Render()** m_pd3dDevice->SetTexture( 0, m_TextureConstructLogo ); m_pd3dDevice->SetFVF( D3DFVF_SCREENVERTEX ); m_pd3dDevice->SetStreamSource( 0, m_ViewportVB, 0, sizeof(SCREENVERTEX) ); m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP,0, 2 ); Is there a DirectX function that will allow me to change the alpha values of the texture directly? Thanks for your help, Pete

Share this post


Link to post
Share on other sites
Look into Alpha Blending. It's a render state. (D3DRS_ALPHABLENDENABLE, D3DRS_SRCBLEND, D3DRS_DESTBLEND in the documentation)
What I would do is make a dynamic vertex buffer (D3DUSAGE_DYNAMIC) and modify the alpha component every time you want to make it more transparent until it's completely blended wih the background.

- Jordan

Share this post


Link to post
Share on other sites

This topic is 4730 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this