[SOLVED] Development on Raspberry Pi 4

Hi everyone.

I recently bought a RP4 and setup java and intelliJ on it and tried to run my existing game code which is very basic and was getting runtime issues because it could not find the native .so file. After digging around I found that LWJGL recently released version 3.2.3 which has finally added support for arm natives. So I edited my gradle file to depend on the new 3.2.3 version and to my surprise it was able to find the library.

My happiness was short lived though because it soon failed with an error because RP4 does not support OpenGL 3.0. It supports OpenGL ES 3.0 but only OpenGL 2.1. I changed to OPENGL 2.0 but I was getting another error which I have not yet debugged.

I then tried to do a hack and modified the RENDER_CONFIGS in LwjglWindow to have OPENGLES3. But I later found that there is a later check for SUPPORTED_RENDERS in LwjglContext which pretty much forces you to the OpenGL implementations.

I know that JME3 for android uses OpenGL ES 3 so I would assume JME3 is compatible.

I would greatly appreciate if anyone can direct me on how to use OpenGL ES on my raspberry pi 4.

Meanwhile I guess Iā€™ll try to figure out why OPENGL2 is not working.

Thanks everyone.

2 Likes

Hi,

After debugging, it turns out that the error is due to the format DXT1A not being supported. it is a texture compression that apparently is propietary and raspberry pi drivers don-t support it. I tried to follow this post but still didnā€™t work:

It might be that it is because Iā€™m running OpenGL 2 instead of OpenGL ES 3. but I donā€™t know. If anyone could also shed some light here I would appreciate it.

Thanks.

s3tc should be available by default in newer mesa
https://www.phoronix.com/scan.php?page=news_item&px=S3TC-Lands-In-Mesa

That is weird. I have Mesa version 19 but still no S3TC. Maybe the driver for the Pi doesnā€™t have it yet? I already posted in their forums asking.

In case this helps, recently OpenGL ES 3 support for JME added through this PR but It is not merged yet and needs testing.

You may like to give it a try :slightly_smiling_face:

That PR looks nice. It seems to be thought for Android though. It is true that the core will have the capabilities, but I am using the jme-desktop dependency since the pi is not exactly a mobile device. The problem is the jme-desktop seems to force OpenGL only. For now I guess Iā€™ll stick to OpenGL 2.0 and see if I can use another uncompressed texture to bypass the S3TC issue.

Welcome to our community, superjugy.

To properly support RP4, JME would need to define a new com.jme3.system.Platform value for it.

That is correct. That is similar to what the LWJGL did. They added a build identifier so now they have linux and linux-arm. Plus they separated the architecture in separate jars. So now the natives-windows jar is 64bits only and the natives-windowsx86 jar is 32 bits only. Same for linux 32 and 64. So yeah we would need to add the linux arm platform, not just android-arm.

I was able to override the dependencies and get the right natives, but my program blowed up when I tried to set the renderer to LWJGL-GLES3 but it doesnā€™t exist :P. I then tried to force the render by adding it to the list of RENDER_CONFIGS but was stopped because I didnā€™t add it to the list of SUPPORTED_RENDERERS. So I am not sure if adding the platform or not is needed, or just adding the renderer. LWJGL was not complaining, it was JME.

Is there a reason to have the ARM only in the android package and not the desktop package? Same for GL ES only being in the android package? ARM is coming to more than just mobiles now, I think there is no reason for the desktop package to limit to GL only.

I would love to submit a PR but I am not really that familiar with the internals of JME

Just to be clear. The lwjgl3.so was able to be extracted by LWJGL after I overrode the dependencies to LWJGL to 3.2.3. So it appears that it used its own extracto instead of the extractor in the dektop package. Actually, I searched for usages of the extractor in the desktop package and I found none. So I really donā€™t know what creating a new platform would be for. Sorry if I missed something in the code, as I said Iā€™m new to JME3 internals.

And thanks for the help!

Edit: Small correction. It is not the desktop package that is limiting. it is the jme3-lwjgl3 package. Specifically LwjglContext and LwjglWindow have the supported renderers and render configs Set and Map that donā€™t allow GL ES. I am not sure if the lwjgl3 package is for desktop only though, since otherwise how would android use GL ES?

1 Like

JME uses other native libraries besides lwjgl3, including glfw, openal, jinput, and bulletjme.

JMEā€™s NativeLibraryLoader is definitely used to load bulletjme, but perhaps a basic game doesnā€™t require physics. Iā€™m unclear how the other native libraries are loaded.

Oh, you are right. I was so focused on trying to get the rendering working that I forgot the other parts. And since Iā€™ve not been able to even get that working I hadnā€™t gotten any other exceptions. Guess compiling on the pi was a more ambitious project than I thought.

Youā€™re not the only person interested in running JME on a Raspberry Pi:
arm32/64 linux support ?? Ā· Issue #1101 Ā· jMonkeyEngine/jmonkeyengine Ā· GitHub

Well, If I can be of assistance let me know.

1 Like

I would like to be able to run JME on a Pi but not strongly enough to figure out how to make it work.

So just know that there are probably others in the wings hoping someone will figure out how to wire this up properly.

(I have a Pi connected to my TV as a retro-pi console and it would be fun to be able to run JME games on it.)

hi, have you tried an Android image on your raspberry pi 4. because jme apps runs on raspberry pi 3 and orange pi using android, maybe is not what you wanted but at least you could use jmonkey on your pi

Hi, do you mean installing android instead of raspbian? The whole point was to install intellij and develop my game while Iā€™m far from my windows machine. Installing Android in the pi would defeat this purpose.

Or did you mean to try using the android package and trick it to use GL ES without an actual android activity?

yes, well as a last resort, lol

OK. For starters, what are the values of System.getProperty("os.name") and System.getProperty("os.arch") for your RPI4?

os.name returns Linux and os.arch returns arm.

Edit: OMG. I donā€™t know what I did, but somehow my game is running with S3TC. I guess I just needed a restart or something. I donā€™t get any exceptions. I havenā€™t added sound and Iā€™m using Nifty-gui.

3 Likes

Congratulations! Trouble solved?

Feel free to post updates if there are further developments.