Detecting the presence of OpenGL?

  1. 2 weeks ago

    Ed K

    Sep 3 Pre-Release Testers, Xojo Pro Kansas City

    Anyone aware of a means to dynamically detect if OpenGL is present and can therefore be used on a given MacOS X version on the specific machine it is running on?

  2. Christian S

    Sep 3 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    What is the problem?

    Every Mac running MacOS 10.9 or later should do OpenGL just fine.

  3. Dave S

    Sep 3 San Diego, California USA

    deprecated in 10.14

  4. Brian O

    Sep 4 Pre-Release Testers, Xojo Pro Calgary, AB

    I think we need a metal canvas.

  5. Bob K

    Sep 4 Pre-Release Testers, Xojo Pro, Third Party Store Kansas City

    @Dave S deprecated in 10.14

    Deprecated but not removed. Yet. The Catalina beta's all still have it.

  6. Norman P

    Sep 4 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    @Ed K Anyone aware of a means to dynamically detect if OpenGL is present and can therefore be used on a given MacOS X version on the specific machine it is running on?

    I'm wondering if this is fruitful since if your app requires OpenGL it wont start on a machine without OpenGL (at least thats what I would expect)
    Effectively OpenGL would be a missing dependency

    I suppose the other option would be to see if you can create an NSOpenGLContext and if that fails then its very likely OpenGL is not available in any way thats useful

  7. Graham B

    Sep 4 Pre-Release Testers, Xojo Pro The Canada's

    @Bob K Deprecated but not removed. Yet. The Catalina beta's all still have it.

    I found building on 10.14.x with latest xojo 2019, OpenGL would not work as expected, namely a black screen. Building with with 2018rX worked though. (I think those were the versions)

    We exposed all the metal classes and rewrote for that. It is a lot more complex than OpenGL, well the simple 2d stuff I was doing was. You needed a lot of classes just to get a triangle showing :P

    In total there are around 130 classes to support all features. There are some neat features as well, like iosurfaces to share memory with gpu between apps so you can load textures etc in a helper app and push to gpu.

    As for detecting when to support OpenGL we just disabled for 10.14.x and above, forcing users to metal, which ran a lot better.

  8. Norman P

    Sep 4 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    @Graham B We exposed all the metal classes and rewrote for that.

    Geez you could probably pull that out and sell that in the Xojo world on its own for a decent price
    At the very least speak at XDC about this undertaking
    I'm impressed

  9. Graham B

    Sep 4 Pre-Release Testers, Xojo Pro The Canada's

    The code isn't mine to sell :( and also don't be too impressed, I didn't expose all the functionality behind the classes, I just needed them as placeholders incase I needed to use them.

    I would be happy to help anyone get started on it as well. The more people understanding it the better for when apple screw it all up in the next release. @Sam R got me started on the basics.

  10. Christian S

    Sep 4 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    You guys checked the SceneKit classes in MBS Plugins?

  11. Sam R

    Sep 4 Pre-Release Testers, Xojo Pro, Third Party Store Hengchun, Pingtung, Taiwan
    Edited 2 weeks ago

    @Brian OBrien I think we need a metal canvas.

    Yes & No. My experience is based solely on using Metal as a display portal for Core Image rendering.

    1. It's not x-plat.
    2. Guaranteed Metal support is quite limited, macOS 10.14 uses Metal only. for other versions you should support OpenGL as well.
    3. There are inconsistencies across Metal devices, I currently think that it's down to different GPUs and certain color spaces.
    4. Metal's co-ordinate system is different to OpenGL (absolute instead of relative).
    5. Certain functions in Metal crap their pants when encountering values outside of 0.0 ~ 1.0.
    6. Support for runtime shaders is going away, so all Metal shaders will have to be pre-compiled (which makes it much harder to write, test & improve custom shaders).
    7. You need to use Xcode to create Metal libraries (runtime shaders can be generated using Xojo code and declares).

    Unless you're specifically targeting Apple only devices, look at alternative solutions.

or Sign Up to reply!