Original Post
Hello,
I have a function in VB.NET to get the bits of a texture. This is my code so far:
Function img_GetBits(ByVal Key As String) As Byte()
Dim Bits() As Byte
With Tex(Key).Texture
With .LockRectangle(0, New Rectangle(0, 0, Tex(Key).width, Tex(Key).height), Direct3D.LockFlags.ReadOnly)
''TODO: Copy data to Bits array
End With
.UnlockRectangle(0)
End With
Return Bits
End Function
I have two problems: One is that the LockRectangle statement returns an error (I have tried just about every overload of LockRectangle). Also, once I get it working, how would I go about copying the data to my array? (My bit array should contain the R, G, B, and A values of each pixel)
Thanks in advance.