Hi there guys! I have a design use case that seems...
# compose-android
x
Hi there guys! I have a design use case that seems like a perfect fit to use a shader with
AGSL
. I have it defined and working, but the required API level 33 for the
RuntimeShader
is a big limitation. Is there any workaround? Are there any plans for back-porting shaders to previous versions? @romainguy
s
I don't think that'd be possible. Otherwise we'd have things like blur etc working on old API versions
๐Ÿ‘ 1
๐Ÿซ  1
h
It's not possible for older versions as it's added in the OS itself
s
OpenGL gives you the ability to control every pixel and design your shaders, basically on any Android version supported by JP Compose. Just a heads-up, to ensure smooth integration with the rest of Compose UI, you'll have to create an OpenGL backend for Compose. But, I'm quite confident it'll add only an extra layer of enjoyment to your development process. ๐Ÿ˜„
x
That's interesting @Sergey Y., do you have any documentation on how to use OpenGL on Android?
s
On Android you need to use OpenGL ES, which is essentially a variant of regular OpenGL with some minor differences. To learn how to program with OpenGL, you can utilize most of the existing literature available for OpenGL 3.x. To get started with Android development, you can check this out: https://developer.android.com/develop/ui/views/graphics/opengl
May your journey into the world of Graphics Programming be filled with creativity, discovery, and endless inspiration. ๐ŸŽ‰
take what I'm saying with a pinch of salt ๐Ÿ˜…
๐Ÿ˜‚ 1
r
Note that while you can use Open GL directly, you won't be able to apply shaders to Composables without first capturing them into bitmaps/textures.
โค๏ธ 1
We could backport RenderEffect as-is but it would require bundling Skia (large binary size) and it would break View/Compose interop
โค๏ธ 1
s
What I wanted to say. To implement OpenGL abstractions at Compose foundation level, and make special build of Compose OpenGL. Currently, I'm trying to do it, for fun ๐Ÿ˜„
r
Having done this myself for Android 3.0 to Abdroid P, don't :)
๐Ÿš€ 3
๐Ÿคฃ 3
s
But it is fun
r
You can "just" use Skiko instead like Jetbrains does for Desktop and iOS
x
Oh, I wasn't aware of the interop limitations associated with RenderEffect. As much as I'd love to go deeper in this knowledge, any of these approaches is rather overengineering for my use case. This being my first time using AGSL, I can say that it's being a really fun experience ๐Ÿ™‚ (Of course, I haven't gone to the real "fun" that you're saying @Sergey Y. ๐Ÿ˜‚ )