Jump to content
  • Advertisement
Sign in to follow this  

[.net] Replacing the Alpha Channel of a texture in VB.net

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

Weel.. I was wondering if anyone knows an idea of replacing the alpha channel of a texture bij another one. What I would like to do is that I make or load a custum 8 bit greyscale picture...and puth that in texture as an alpha channel...Or replace it from another texture wich has Alpha... I can work with an alpha channel as the following example shows
Private Sub Alpha(ByVal m_device As Device, _Fill as integer)
        With m_device
            .RenderState.TextureFactor = Color.FromArgb(_Fill, 255, 255, 255).ToArgb()
            .TextureState(0).AlphaOperation = TextureOperation.Modulate
            .TextureState(0).AlphaArgument1 = TextureArgument.TextureColor
            .TextureState(0).AlphaArgument2 = TextureArgument.TFactor
        End With
End Sub

Share this post

Link to post
Share on other sites
Altering the alpha renderstates just changes how the alpha component is rendered, it doesn't change the actual alpha data.

You'll need to actually copy the data between the textures by locking them and reading and writing between them.

edit- alternatively, you could also look at stencil buffering.

[Edited by - gharen2 on February 2, 2008 2:29:50 PM]

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!