View Single Post
Old 06-23-2009, 12:42 PM
Richard87 Richard87 is offline
Junior Contributor
Join Date: Sep 2004
Posts: 235

OK, i managed to produce a picture, but I have still some problems(here is my code:

                        Dim bm2() As Byte
                        Dim bData(BufferLen) As Byte

                        m_text = New Texture(Display, 1024, 512, 0, Usage.Dynamic, Format.X8R8G8B8, Pool.Default)
                        bm2 = m_text.LockRectangle(GetType(Byte), 0, rect, Microsoft.DirectX.Direct3D.LockFlags.None, IPA)

                        Marshal.Copy(pBuffer, bData, 0, BufferLen)

                        Dim X As Integer = 0, y As Integer = 0
                        Dim stride As Integer = 640 * 3, stride2 As Integer = 1024 * 4

                            Array.Copy(bData, X, bm2, y, stride)

                            X = X + stride
                            y = y + stride2
                        Loop Until y >= bm2.Length

but my as you can notice, my data is coming in as 24bits(1byte for each color), but my textures takes 32bits in(1byte for alpha channel)

my question is, what is the most effective way of inserting 1 byte for every 3 byte in the array?
Reply With Quote