metalangle
metalangle copied to clipboard
is it possible to create an Angle surface from an external Metal Layer
Hi,
I'm extremely grateful that you wrote this library!
I'm evaluating to use Angle to implement a WebGL plugin for Flutter Apps. The graphic backend of Flutter on iOs and MacOS is currently migrated to use metal instead of OpenGL.
So my question is, if I can get access to the Metal layer of a Flutter Texture, would it be posible to create an OpenGL ES surface from this that could be used with MetalAngle to draw on it?
Cheers Thomas
Hi, Yes, you can import external Metal texture to MetalANGLE to create an EGLImage object, then you use it to create OpenGL texture object that can be used as attachment of a framebuffer which will be able to be rendered into. This is example:
- Import
MTLTexture
to createEGLImage
object: https://github.com/kakashidinho/metalangle/blob/9cfbd26f3dc600713704de5ebb33f542fa65c739/src/tests/gl_tests/ImageTestMetal.mm#L332 - Bind
EGLImage
to GL texture object which can be used by OpenGL functions: https://github.com/kakashidinho/metalangle/blob/9cfbd26f3dc600713704de5ebb33f542fa65c739/src/tests/gl_tests/ImageTestMetal.mm#L348
Thanks a lot!