Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How I can install this? #58

Open
dortamiguel opened this issue Jun 2, 2021 · 6 comments
Open

How I can install this? #58

dortamiguel opened this issue Jun 2, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@dortamiguel
Copy link

dortamiguel commented Jun 2, 2021

Hi, I have and OpenGL app using SDL and I will like to try metalangle

I downloaded the MetalANGLE.dylib.mac.zip file but I'm not sure how I'm supposed to use it.

The headers is easy, I just include them, but, what I do with this dylib files?

  • libEGL.dylib
  • libGLESv1_CM.dylib
  • libGLESv2.dylib

I should include them all?

After including the headers, and linking the dylib files. Should I do something special to start using OpenGL on the app?

The only thing I can get is a black screen

@kakashidinho
Copy link
Owner

kakashidinho commented Jun 3, 2021

This is a bit complicated. Even though MetalANGLE implements the same OpenGL ES APIs as Apple's. There are differences in the way OpenGL contexts are created (OpenGL context creation API is not part of OpenGL standards, so it's understandable that MetalANGLE and Apple's GL are different in this area).
Because SDL creates the OpenGL context for you internally, and SDL currently uses Apple's GL context API, it cannot be used with MetalANGLE atm.

There are some efforts to port MetalANGLE to SDL libsdl-org/SDL#4333 or you can use his SDL fork here.
Besides I think @elix22's Urho3d fork also has some modifications to make SDL work with MetalANGLE (perhaps without modifying SDL itself). Perhaps SDL already has supports for EGL context API which MetalANGLE implemented. @elix22 pls let us know if you have any insights, it would be a great help, thanks.

@kakashidinho kakashidinho added the enhancement New feature or request label Jun 3, 2021
@MikeHart66
Copy link

Can MetalAngle be used with a Metal context created in GLFW?

@kakashidinho
Copy link
Owner

kakashidinho commented Jun 3, 2021

After some research I noticed that SDL can be used with MetalANGLE. However, you need to compile SDL with these flags:

SDL_VIDEO_OPENGL_CGL=0
SDL_VIDEO_OPENGL=0
SDL_VIDEO_OPENGL_EGL=1
SDL_VIDEO_OPENGL_ES2=1

Note: you can only use OpenGL ES API (not full Desktop OpenGL APIs) in this case.
And need to set DYLD_LIBRARY_PATH env to point to directory containing libEGL.dylib & libGLESv2.dylib before starting the app so that SDL can dynamically load these libraries when creating OpenGL context.

@kakashidinho
Copy link
Owner

Can MetalAngle be used with a Metal context created in GLFW?

@MikeHart66 MetalANGLE can interoperate with Metal context created in GLFW. i.e. MetalANGLE and Metal can both draw to a shared metal texture. This requires some knowledge about Metal though. I can create an example some time later if you need.

@TrajansRow
Copy link

I've been prototyping a (potentially worse) way to do this in one of my apps. The approach is to take an SDL window and add an MGLLayer into it:

https://github.com/TrajansRow/alephone/blob/angle/Source_Files/RenderOther/MacOSHelper.mm

@MikeHart66
Copy link

MikeHart66 commented Jun 3, 2021

Can MetalAngle be used with a Metal context created in GLFW?

@MikeHart66 MetalANGLE can interoperate with Metal context created in GLFW. i.e. MetalANGLE and Metal can both draw to a shared metal texture. This requires some knowledge about Metal though. I can create an example some time later if you need.

Of course it would help tremendously. But we don't need to draw from Metal and MetalAngle. Currently we use Glfw for setting up the context for OpenGl and use OpenGl ES2 to draw stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants