Original Post
Could someone please explain to me what I am doing wrong here? The texture returned from this method is blank:
Public Function getTextureFromFile(fileName As String) As Direct3DTexture8
''Load a texture from file
Dim img As ftImage, temp As Direct3DTexture8
Dim lr As D3DLOCKED_RECT
img = getImageFromFile(fileName)
''Init the texture
Set temp = man.forXFiles.CreateTexture(man.dxDevice, img.info.bmiHeader.biWidth, img.info.bmiHeader.biHeight, 1, DIB_RGB_COLORS, D3DFMT_R8G8B8, D3DPOOL_MANAGED)
temp.LockRect 0, lr, ByVal 0, 0
DXCopyMemory ByVal lr.pBits, img.data(0), (img.info.bmiHeader.biSizeImage + 1) * 3
temp.UnlockRect 0
Set getTextureFromFile = temp
End Function
PS: The reason I am doing it this way is I need to be able to load textures from binary data I have stored in my custom resource file. This method is so that I can figure out how to do it.