Jump to content
  • Advertisement
Sign in to follow this  
Temjin

Fading textures - DirectX 9 c++

This topic is 4975 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
Advertisement
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
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!