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

Started by
0 comments, last by gharen2 16 years, 3 months ago
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
Advertisement
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]

This topic is closed to new replies.

Advertisement