You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Android has GL calls to allow providing a Bitmap as texture data, Currently you need to copy the bitmap to a buffer before you can pass it to Kgl
When you load an image in android, You usually load a Bitmap for it
If you do load an image as buffer, You also need to provide a width and height, easy solution becomes loading a bitmap since it contains width and height, If you need to be memory efficient, You'll load the bitmap inJustDecodeBounds to get width and height and then load the bitmap as buffer which is a bit complex
Bitmap doesn't provide access to a Buffer object, It does but that's HardwareBuffer which doesn't extend Java Buffer
The constructor for Buffer that takes a Java Buffer is internal (even if it were public, there's no buffer)
When you load a bitmap, You must copy over the pixels from bitmap to a Buffer which is more work & not the best way !
Solution : Introduce TextureAsset interface, Make TextureResource implementation of TextureAsset
TextureResource can be a deprecated typealias for BufferTextureAsset (Later)
Split JVM to android & desktop target
Keep JVM TextureResource same in desktop, Keep other types same in both android and desktop
Create TextureAsset interface in commonMain & make TextureResource implement TextureAsset
TextureBitmapAsset can be implemented on Android
TextureAsset basically has methods that are called by Kgl itself to make gl calls & its given a Kgl instance with that call and parameters (There is no other way)
The only CON with this solution is that anyone can implement TextureAsset, in my opinion that is OK since
I've implemented it in the linked pull request, except for the iOS platform since I work on windows !
The text was updated successfully, but these errors were encountered:
Use Case
Android has GL calls to allow providing a Bitmap as texture data, Currently you need to copy the bitmap to a buffer before you can pass it to Kgl
Solution : Introduce TextureAsset interface, Make TextureResource implementation of TextureAsset
TextureResource can be a deprecated typealias for BufferTextureAsset (Later)
The only CON with this solution is that anyone can implement TextureAsset, in my opinion that is OK since
I've implemented it in the linked pull request, except for the iOS platform since I work on windows !
The text was updated successfully, but these errors were encountered: