clicky
Posts: 226
Joined: Thu Oct 25, 2012 7:34 am

Re: LibGDX on RPi

Mon Feb 12, 2018 9:37 am

Hi, I have encountered same problem as you are right now and I've done something to overcome it. I just cannot remember what was it. I suspect I just upgraded distro at the end as that seemed the simplest. Box that might have all of it is due to circumstances not on the net at the moment - I'll attach it in aprox. 4 hours form now and I'll be able to have a quick look and I'll let you know...

msx80
Posts: 10
Joined: Sun Feb 11, 2018 4:36 am

Re: LibGDX on RPi

Mon Feb 12, 2018 10:10 am

Don't worry, i actually managed to solve the problem, it was indeed a mismatch in libgdxarmgnueabihf.so shipped with your rpi-enabled libgdx.
Maybe you cross-compiled them or indeed hade some different distro before/after. Btw, i'm not a c/c++ expert so maybe i'm talking nonsense, but are we sure we need to link to libstdc++.so ? If it's possible at all to avoid, it would be great becouse i'm afraid new versions of Raspbian/Retropie would require recompilation and that's pretty bad.

Anyway, to solve it i compiled the .so directly on the raspberry using your build-jni-for-rpi.sh (which btw has a copy/paste typo you should fix (double ant -f), i hope that's not the ultimate source of the problem :P). It outputted some valid version of the libraries, i copied them on rpi-enabled libgdx, built it and it worked!

Great job clicky! I can report that:
  • * gdx-controllers works great, but the event based version fire events continuously even if nothings is touched, while regular desktop version fires only if the controller was moved (not sure if the problem is in the controllers driver or in some point inside libgdx).
    * JoglNewtApplication/JoglNewtApplicationConfiguration don't seem to honor the foregroundFPS and backgroundFPS. Are you the author of the jogl backend?
Another question, do you think rpi support will ever be merged into official libgdx ?

clicky
Posts: 226
Joined: Thu Oct 25, 2012 7:34 am

Re: LibGDX on RPi

Mon Feb 12, 2018 10:24 am

Good to hear you've sorted it. :) You've intrigued me and I'll check what I've done + update example to work with the latest + move version to stable 1.9.8 and 1.9.9 snapshot. Ah, only question when! LOL

To answer your questions:
1. I am not C/C++ expert by any means. Not even apprentice or enthusiast. So there are two of use - blind leading blind
2. I am not author of anything LibGDX. I wouldn't know more than you do about joystick support. At one point I started looking into what is happening with OSX impl, but I don't know anything about OSX works, C/C++...
3. I am not JOGL author nor associated with them. Work here is mere derivative of what @xranby (he might be closer to jogl) and others (one of the topics: viewtopic.php?f=81&t=112806) did...
4. I don't think this will be merged back to LibGDX. Current build system there is quite convoluted and they've rejected some half way solutions like this one is and there is nobody willing to put together full/proper solution - hence my fork :(

msx80
Posts: 10
Joined: Sun Feb 11, 2018 4:36 am

Re: LibGDX on RPi

Tue Feb 20, 2018 10:13 am

Hi there, i managed to make everything work decently. I was wondering if you could update your repository with a working version (that is, with the correct libgdxarmgnueabihf.so ) of either 1.9.8 or 1.9.9? That way people could build our projects without having to build the whole libgdx.

If anybody needs it, to make audio work, the quickest way is to run a "sudo modprobe snd_pcm_oss". This will load a wrapper library to make alsa interoperate with oss, since libgdx uses OpenAL and OpenAL uses oss. I tryed to make OpenAL talk to Alsa directly but couldn't, and i was warried that something else could break somewhere else so gave up :P

alexis-puska
Posts: 6
Joined: Sat May 05, 2018 2:18 pm

Re: LibGDX on RPi

Sat May 05, 2018 2:23 pm

Hi all,

I follow this instruction to create a project and a subproject for my raspberry pi. I create the jar and that run correctly. But i continue the development of my game, and when i used freeType, i package the project test on my pi, and i get trouble with the libgdx-freetypearmgnueabihf.so
Caught GdxRuntimeException : Couldn't load shared library 'libgdx-freetypearmgnueabihf.so'

I read that a developper add to libgdx all stuff to compile libgdx freeType for arm, i have found the github repository, but nothing on the description to compile. The library is outdated 1.9.5 -> current 1.9.8. How can i compile and use the compilation in my project ?

thx

barkholt
Posts: 5
Joined: Thu Nov 09, 2017 6:41 pm

Re: LibGDX on RPi

Wed Sep 12, 2018 10:41 am

@clicky

Can we get access to your 1.9.7/8 builds? The link https://raw.githubusercontent.com/natda ... /mvn-repo/ you posted is not valid?

I'm kinda depending on the great work you have been doing, and would really like it if we could get some kind of stable tracking of the primary repo going.

clicky
Posts: 226
Joined: Thu Oct 25, 2012 7:34 am

Re: LibGDX on RPi

Sun Oct 07, 2018 8:09 pm

Apologies for the late response - I've just tested it and it seems to be working.

I've picked my 'test' project: https://github.com/natdan/rpi-libgdx-example

Updated versions (of almost everything that has something to do with gradle - eh) - including LibGDX to be 1.9.8.rpi and - it fetched all and built without issues...

Want to give it a go and let me know?

alexis-puska
Posts: 6
Joined: Sat May 05, 2018 2:18 pm

Re: LibGDX on RPi

Sun Nov 04, 2018 6:45 pm

Hi all,

I've tested your dev, that work, i follow your build.gradle add your repository to update jogl backend to the 1.9.8-rpi.SNAPSHOT version.

i have a problem with the controllers... Each time when i resize the app, we need to clear listeners and add listeners on controllers for get work. I made a controller mapper for network controllers, local controllers , keyboard event and i have a problems when i try to get the all controllers connected.

Get list of controller

Code: Select all

Array<Controller> controllers = Controllers.getControllers();
clear listener, wait add listeners on controller

Code: Select all

public void resize(int width, int height) {
		this.viewport.update(width, height, true);
		Gdx.app.log(LOG_NAME, "RESIZE");
		try {
			Thread.sleep(500);
			Controllers.clearListeners();
			Controllers.addListener(controllerAdapter);
		} catch (InterruptedException e) {
			Gdx.app.error("MultiBomberman", "Resize thread error");
			Thread.currentThread().interrupt();
		}
	}

the libgdx program crash with this stack trace :


Exception in thread "main-Animator#00" com.jogamp.opengl.util.AnimatorBase$UncaughtAnimatorException: com.jogamp.opengl.GLException: Caught NoSuchFieldError: JoglGL on thread main-Animator#00
at com.jogamp.opengl.util.DefaultAnimatorImpl.display(DefaultAnimatorImpl.java:68)
at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
at com.jogamp.opengl.util.Animator$MainLoop.run(Animator.java:204)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.jogamp.opengl.GLException: Caught NoSuchFieldError: JoglGL on thread main-Animator#00
at com.jogamp.opengl.GLException.newGLException(GLException.java:76)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1327)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759)
at com.jogamp.opengl.util.DefaultAnimatorImpl.display(DefaultAnimatorImpl.java:58)
... 3 more
Caused by: java.lang.NoSuchFieldError: JoglGL
at com.badlogic.gdx.backends.jogamp.JoglGraphicsBase.getType(JoglGraphicsBase.java:366)
at com.badlogic.gdx.controllers.Controllers.initialize(Controllers.java:96)
at com.badlogic.gdx.controllers.Controllers.clearListeners(Controllers.java:67)
at com.mygdx.main.MultiBombermanGame.resize(MultiBombermanGame.java:127)
at com.badlogic.gdx.backends.jogamp.JoglGraphicsBase.reshape(JoglGraphicsBase.java:164)
at jogamp.opengl.GLDrawableHelper.reshape(GLDrawableHelper.java:751)
at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:440)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
... 6 more
AL lib: (WW) FreeContext: (0x668c4c30) Deleting 16 Source(s)
AL lib: (WW) FreeDevice: (0x668cfac0) Deleting 18 Buffer(s)
EGLDisplayUtil.EGLDisplays: Shutdown (open: 1)
EGLDisplayUtil: Open EGL Display Connections: 1
EGLDisplayUtil: Open[0]: 0x1: EGLDisplayRef[0x1: refCnt 2]


If any body have an idez i take it.

my project : https://github.com/alexis-puska/MultiBomberman

Alexis


Edit :
I think that this line of code the problem inside the JoGL librarie code :

Code: Select all

@Override
	public GraphicsType getType () {
		return GraphicsType.Jogl;
	}
Inside the Libgdx source code this value is note inside the enum class :

Code: Select all

public interface Graphics {
	/** Enumeration describing different types of {@link Graphics} implementations.
	 *
	 * @author mzechner */
	public enum GraphicsType {
		AndroidGL, LWJGL, WebGL, iOSGL, JGLFW, Mock, LWJGL3
	}
Issue open with libgdx : https://github.com/libgdx/libgdx/issues/5442
Last edited by alexis-puska on Sun Nov 04, 2018 7:52 pm, edited 1 time in total.

clicky
Posts: 226
Joined: Thu Oct 25, 2012 7:34 am

Re: LibGDX on RPi

Sun Nov 04, 2018 7:51 pm

Honestly - no idea. Maybe what you suggested would help - adding JOGL to the list of enums. Do let me know if you need help with recompiling all on RPi after those changes... You can always manually move changed jar to your app and see if it works...

alexis-puska
Posts: 6
Joined: Sat May 05, 2018 2:18 pm

Re: LibGDX on RPi

Sun Nov 04, 2018 8:17 pm

I don't know what is the specification of the libgdx package for raspberry pi that you made, can you say me what is the change with the official package and how you compile it ? i think you use gradle assemble ?

clicky
Posts: 226
Joined: Thu Oct 25, 2012 7:34 am

Re: LibGDX on RPi

Sun Nov 04, 2018 8:34 pm

The easiest is to clone repo (https://github.com/natdan/libgdx) and go from there... Branch 'rpi' has the latest in that repo.

There's a script `build-jni-for-rpi.sh` that builds RPi specific stuff...

Rest is linked at the top of this thread...

alexis-puska
Posts: 6
Joined: Sat May 05, 2018 2:18 pm

Re: LibGDX on RPi

Sun Nov 04, 2018 9:17 pm

This fork use maven ?

When i read the build.gradle, this is always stay in 1.9.5 version... i see a pom.xml and the goal compilation is 1.9.8 ?

filename too long for 2 file... great with windows... go install a VM....

clicky
Posts: 226
Joined: Thu Oct 25, 2012 7:34 am

Re: LibGDX on RPi

Sun Nov 04, 2018 10:09 pm

I've done the same as original - I think it was maven...

alexis-puska
Posts: 6
Joined: Sat May 05, 2018 2:18 pm

Re: LibGDX on RPi

Tue Nov 06, 2018 9:54 am

I have succed to compile it directly on Rpi ! on cross compilation so many problems...
JoGl is outdated and deprecated by libgdx... but maintenaned on third party like the repository like natdan repo... for LTS it's not the best solution...

Return to “Java”