Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function CreateImageFromMemory(ByRef Image() As Byte, _
- Optional ByVal Mipmap As Boolean = False, _
- Optional ByVal Layer As Integer = 1, _
- Optional ByVal Format As CONST_VIDEO_TEXTURE_FORMAT = TEXTURE_FORMAT_RGBA8, _
- Optional ByVal Flag As CONST_VIDEO_TEXTURE_FLAG = TEXTURE_FLAG_NONE) As TYPE_VIDEO_IMAGE
- Dim wTexture As Long
- '
- ' Parse the image
- '
- wTexture = STB_C.stbi_load_from_memory(ByVal VarPtr(Image(0)), UBound(Image) + 1, CreateImageFromMemory.mX, CreateImageFromMemory.mY, CreateImageFromMemory.mChannel, &H0)
- '
- ' Create the texture with the image
- '
- CreateImageFromMemory.mHandle = CreateTexture2dFromMemory(CreateImageFromMemory.mX, CreateImageFromMemory.mY, Mipmap, Layer, Format, Flag, Copy(wTexture, _
- CreateImageFromMemory.mX * CreateImageFromMemory.mY * CreateImageFromMemory.mChannel))
- Call STB_C.stbi_image_free(wTexture)
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement