Apple Silicone, OpenAL and OpenGL issues

I am working on making my app compatible with the new Apple Silicone. When I attempt to run my app Intel based app on the the new M1 processor I am having issues with the renderer not working properly. In the image the yellow should actually be grass turf and the other architecture should be a concrete stadium.

I have been able to locate and install a version of Java that is made for the new apple architecture. However when I attempt to launch I am having issues with liblwjgl.dylib not finding a file for the new apple architecture. I have the same issue with the libopenal.dylib.
I get the following error

Exception in thread “jME3 Main” java.lang.UnsatisfiedLinkError: /Applications/Pyware 3D v10/libopenal.dylib: dlopen(/Applications/Pyware 3D v10/libopenal.dylib, 1): no suitable image found. Did find:
/Applications/Pyware 3D v10/libopenal.dylib: no matching architecture in universal wrapper
/Applications/Pyware 3D v10/libopenal.dylib: no matching architecture in universal wrapper
at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2627)
at java.base/java.lang.Runtime.load0(Runtime.java:768)
at java.base/java.lang.System.load(System.java:1837)
at com.jme3.system.NativeLibraryLoader.loadNativeLibrary(NativeLibraryLoader.java:683)
at com.jme3.system.lwjgl.LwjglContext.loadNatives(LwjglContext.java:178)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:209)
at java.base/java.lang.Thread.run(Thread.java:834)

Has anyone else had any experience with this?
I am currently building this with 3.2 Stable.

This is the key to your issue. The new Applie Silicone is a ARM processor, not an x86 processor. You need to use arm compiled binaries.

EDIT: I will clarify. These arm binaries will either need to come from lwjgl, or you will need to compile lwjgl osx binaries for arm yourself if they do not yet have them, which last I looked they did not.

EDIT 2: There is currently an issue open for this: Provide support for ARM64/M1 devices (Windows and macOS) · Issue #601 · LWJGL/lwjgl3 · GitHub

1 Like

With Rosetta the X86 files should still work and they are running however the renderer is not displaying the textures properly. Is there a solution when running the first way where I am using the intel java through rosetta?

—> Can you post the stacktrace for the liblwjgl.dylib?

I do believe that if you are not launching from an application that was launched with Rosetta, that it will not work. Rosetta can run x86 applications because they are using the x86 ABI in MacOS, but when launching a ARM process, I do not believe that Rosetta can translate the x86 ABI to the ARM ABI within a single application. It uses a x86 to ARM API internally to translate the calls to allow a x86 application to run on top of ARM. I have not done any direct development on Rosetta, so I could be wrong, but that is my current understanding. You can run x86 on ARM, not mix a application between x86 and ARM.

Try running using a x86 jdk on Rosetta instead, see if that works. Can you please post the JDK that you are using? Also are you using LWJGL 2 or 3?

EDIT: I think I misunderstood initially, your last post indicates that you are using the x86 jdk with Rosetta? Then please just provide the stack trace for the liblwjgl.dylib, which jdk, and which lwjgl.

I have run it both ways with the arm java and x86 java.

Where would I tell what version of LWJGL I am using? I am using the 3.2 stable set of Binaries.

There is no error dump when I run the program with the x86 Java.

I am using AdoptOpenJDK 11

As you can see in the image it does not look correct.

What would the steps be to change to LWJGL 3?

When i run on an intel mac with the x86 It looks correct.

Right now I am not able to get Netbeans nor the JME SDK to run properly on the M1 mac without crashing. I am building on my intel imac and moving it over to test.

Is there a way that I can run using the OpenGL 4, the caps dump only shows OpenGL2.1 but when I run an open GL viewer I am showing I can run up to OpenGL4.1.

Are you using jme-lwjgl or jme-lwjgl3? And in your graphics.properties file what is the Renderer(string) set to?

I am going to assume this has to do with the new GPU that is part of the ARM soc no supporting something in the opengl version you are using, apple claims that opengl support is still there but deprecated, so it is unclear how well it will work. This could be caused due to that.

I am using jme3-lwjgl, I dont have an option for jme3-lwjgl3.
Where is the download for jme3lwjgl3?

In my settings I am using AppSettings.LWJGL_OPENGL3.

Do you know which version of 3.2 you are using, is it 3.2.4?

I downloaded just the 3.2. I can install any version that you think would be best and go from there.

I am just trying to get it to work.

I actually am not seeing lwjgl3 for 3.2.x… I know it was around during that time though…
@Darkchaos I do not see jme-lwjgl3 packaged with the SDK, nor the dist from the jme github repo on 3.2 releases. I could have sworn that the SDK had the jme-lwjgl3 jar in it.

@dm1056 you may want to attempt to migrate to jme 3.3. Keep in mind, there will be some code changes required when doing this.

I just dropped in JME 3.3.2 and I am having the same issues.
What changes should I have needed to make. It compiled and ran I am just still getting the visual color issues.

Are you using the jme-lwjgl3 jar inplace of the jme-lwjgl jar?

I am unable to find the jme-lwjgl3 jars.

Available here: Version jme3-lwjgl3/3.3.2-stable - jmonkeyengine

Thank you I will test this on the M1 computer and see if it helps.

1 Like

According to https://twitter.com/LWJGL/status/1332769663365865475 they are working on improving the support, so we may need the latest version at some point

Ok, So I have been able to install the version 3 of LWJGL, however I have been unable to make it compile and run. I get a message java.lang.NoClassDefFoundError: org/lwjgl/opengl/GLDebugMessageARBCallbackI.

I attempt to install the LWJGL from their website however it still shows that I am running a 2.9.3 context.

Any input on how to get LWJGL3 to work properly for testing.

I downloaded Minecraft as they also use LWJGL, they are using version 3.2.1 and that render looks correct when running through rosetta.

I am just trying to get the current renderer to work properly on the Apple Silicon.

It seems to be issues with the Shaders, I am not versed enough to fix this, however I am happy to help test if anyone is will to help me take a stab at it.

These issues are present in the SDK as well.

As stated in this issue: Provide support for ARM64/M1 devices (Windows and macOS) · Issue #601 · LWJGL/lwjgl3 (github.com)

The dyncall library that lwjgl depends on has experimental support for arm64. Minecraft uses very primitive opengl calls. Perhaps you can try creating a test app using opengl 1.1 in jmonkeyengine and see if the rendering issues still occur, if not, increase the opengl version until they do. Do this on an app that uses phong and unshaded shaders packaged with jme so that we have a base line of basic functionality that is proven to work on old version of opengl.

If a basic rotating color cube rendered with jme does not work in opengl 1.1, and the equivalent test using pure lwjgl works, then perhaps the issue may be in what calls jme is using for rendering, but regardless it is very likely that the issue is not in jme, but more an issue in lwjgl caused by a dyncall binding not working properly in arm64.

To get the lwjgl 3 jars from the website, use their tool: Customize - LWJGL
Keep in mind that there are no jars for arm64 here.
You can also try building lwjgl yourself for arm64, the ci pipeline here is a reference for how to do so, but it will fail at this point in time. Job #1470.9 - LWJGL-CI/glfw - Travis CI (travis-ci.com)

Your best bet is to wait until dyncall has corrected their issues, so that lwjgl can correct theirs.

@sgold

When I am attempting to use the LWJGL 3 I get an issue.

Context Class Missing
Make sure jme3_lwjgl-ogl is on the classpath

Also is there a version of libbulletjme.dylib for Apple ARM?