Advertisement
Wolftein

Untitled

Feb 24th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. Public Function CreateImageFromMemory(ByRef Image() As Byte, _
  2. Optional ByVal Mipmap As Boolean = False, _
  3. Optional ByVal Layer As Integer = 1, _
  4. Optional ByVal Format As CONST_VIDEO_TEXTURE_FORMAT = TEXTURE_FORMAT_RGBA8, _
  5. Optional ByVal Flag As CONST_VIDEO_TEXTURE_FLAG = TEXTURE_FLAG_NONE) As TYPE_VIDEO_IMAGE
  6.  
  7. Dim wTexture As Long
  8.  
  9. '
  10. ' Parse the image
  11. '
  12. wTexture = STB_C.stbi_load_from_memory(ByVal VarPtr(Image(0)), UBound(Image) + 1, CreateImageFromMemory.mX, CreateImageFromMemory.mY, CreateImageFromMemory.mChannel, &H0)
  13.  
  14. '
  15. ' Create the texture with the image
  16. '
  17. CreateImageFromMemory.mHandle = CreateTexture2dFromMemory(CreateImageFromMemory.mX, CreateImageFromMemory.mY, Mipmap, Layer, Format, Flag, Copy(wTexture, _
  18. CreateImageFromMemory.mX * CreateImageFromMemory.mY * CreateImageFromMemory.mChannel))
  19.  
  20. Call STB_C.stbi_image_free(wTexture)
  21.  
  22. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement