Support OpenGL ES 2 as the rendering API

#6 Open

Bitbucket cannot automatically merge this request.

The commits that make up this pull request have been removed.

Bitbucket cannot automatically merge this request due to conflicts.

Review the conflicts on the Overview tab. You can then either decline the request or merge it manually on your local system using the following commands:

hg update default
hg pull -r default
hg merge af16fee38ffe
hg commit -m 'Merged in chenditc/unity-arkit-plugin (pull request #6)'
  1. Di Chen
  • Add support for OpenGL ES 2 renderer
  • Add support for OpenGL ES 2

Comments (30)

  1. Ina Yosun Chang

    Set unity build graphics settings to open gl es 2 only but these errors still show:

    Undefined symbols for architecture arm64: "_MTLCreateSystemDefaultDevice", referenced from: -[UnityARSession setupMetal] in ARSessionNative.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

    1. Di Chen author

      I have not yet test with OpenGL ES 3. If OpenGL ES 3 is backward compatible to OpenGL ES 2, then it's just a matter of changing the macro.

      The error you posted occured because Metal.Framework is not added to xcode project, this can be fixed by modifying the post build script.

  2. Chris Goy

    Will be testing now. Please address the issues below and we will work towards merging it in. Thanks again

  3. Chris Goy

    I just tested with an iPhone7, rendering api opengles2 and i get a crash in line 355. This is with unity 5.6.2p2

      1. Di Chen author

        I have re-produce this issue. This happens only when I connect my iphone with to my computer. If I unplug the iphone and open the app, it works fine.

        Browsing the code indicate this seems related to the Unity Remote feature. I'm not familiar with Unity Remote Implementation, here is my guess:
        New Unity Remote feature tried to send texture back to computer whenever a connection is present. It tried to use GL_RENDERBUFFER handle, but this handle is not initialized.

        Please try the latest commit.

          1. Di Chen author

            Seems this only happens on iOS beta 4 version. Not sure why, but hope this info helps.

  4. Rasa Vision

    I think there are new changes needed to "" because of what changed in iOS 11 beta 5? I tried merging them myself but currently get a purple screen at runtime on device.

  5. prada hsiung

    do you test this change on the real devices? because I got pool performance on my iPad Pro with iOS 11 beta 6

    1. Di Chen author

      Yes, but not on iOS beta 6. Last time we test it was on iOS beta 5 and still works smoothly. What kind of performance measurement are you talking about? Low FPS?

      1. Rasa Vision

        I tried today with the latest beta, after making the changes in the pull request you linked. It appears to work in two orientations portrait and landscape one way, but if I flip the device 180 degrees, the upside down portrait mode and other landscape mode have black screens for the AR camera but retain tracking and Unity generated graphics.

        1. Di Chen author

          Indeed, this might happen. I don't really understand how to rotate OpenGL image after getting the texture from ARKit, so basically I tried different combination and find one that actually works. If people have more knowledge in OpenGL, please educate me.

  6. Deyu Du

    I update Xcode 9 GM seed and iOS 11 GM seed(iphone6s) today. If I chose OpenGL ES 2 only, the camema view is green, seems like not support OpenGL ES 2 again. My Unity version is 5.6.2f1, arkit-plugin is f2a4021 updated today.

    1. Deyu Du

      I think I find out the files I download from "default" are different with these files......I haven't understand bitbucket

      1. Di Chen author

        Yeah... this is just a pull request, so you will need to clone the repo from my namespace.

  7. Andreas Atteneder

    Unfortunately I've experienced some bad behaviour with this patch.
    The worst is that the screen goes almost black sometimes (You can see some dark color variations though. just the video background, not the 3D content itself). I tried to narrow it down, but couldn't find the cause.
    When it appears, the device orientation seems to be factor (Point neutraly forward: works; point too much upwards/downwards/to the side: screen goes black). Reseting the tracking helps sometimes.
    I assume it has to do with asynchronous nature of ARKit vs. Unity's run loop. ARKit seems to create 10 different buffers for texture pairs (Y and UV) and switch through them. Maybe, whenever the screen goes black, an invalid texture pair is shown.

    The other problem was mentioned before (PortraitUpsideDown and LandscapeLeft (by Unity definition) don't work). I may provide a patch for this as I could solve it.

      1. ZhengzhongSun

        I test your repo with unity 2018.4.2f1 and xcode 10.2.1. It seems not working anymore. It works well with metal, but when I switch the rendering api to opengles, I only see the red background.

  8. ZhengzhongSun

    Using your modification in the newest arkit sdk with unity 2018.4.2f1 and xcode 10.2.1, seems not working anymore. At the same time, this repo also doesn’t work in unity 2018.4.2f1 and xcode 10.2.1, there are a lot of errors, it seems api changed?