Hello,
for a school project i wanted to program a simple jump´n´run game in libgdx on a desktop windows pc and i wanted to play it on a raspberryPi 3.
Unfortunately my linux/pi knowledge is really bad and every tutorial is outdated or links are broken.
Is it still possible to run a libgdx game on a pi? Is there are simple tutorial or can someone explain it simple?
greetings
-
- Posts: 7
- Joined: Mon Jan 16, 2017 8:01 pm
Re: libGDX on raspberryPi 3
Actually it is far easier now. See here: viewtopic.php?f=81&t=163604
Let me know if you have any issues with it.
Let me know if you have any issues with it.
Re: libGDX on raspberryPi 3
that must not be a problem,
you can develop your game and then pass the .jar file of your game to rasp berry, once inside rpi just execute your .jar with java -jar command. that should work, I have been making that without problem.
you can develop your game and then pass the .jar file of your game to rasp berry, once inside rpi just execute your .jar with java -jar command. that should work, I have been making that without problem.
Re: libGDX on raspberryPi 3
Jar is going to work only if it has native libraries for destination platform (in this case ARM of RPi). I think that default RPi does not have them - hence my previous post.
-
- Posts: 7
- Joined: Mon Jan 16, 2017 8:01 pm
Re: libGDX on raspberryPi 3
clicky wrote:Actually it is far easier now. See here: viewtopic.php?f=81&t=163604
Let me know if you have any issues with it.
Aight,im gonna try that tomorrow. Thanks you.clicky wrote:Jar is going to work only if it has native libraries for destination platform (in this case ARM of RPi). I think that default RPi does not have them - hence my previous post.
Are you sure? Which OS you using? I tried the standard rasbian from noobs(desktop version,newest version) and i get following error :pavul wrote:that must not be a problem,
you can develop your game and then pass the .jar file of your game to rasp berry, once inside rpi just execute your .jar with java -jar command. that should work, I have been making that without problem.
Code: Select all
Exception in thread "main" com.badlogic.gdc.utils.GdxRuntimeException : Coulnd´t load shared libary 'libdxarm.so for target : Linux, 32-bit
Re: libGDX on raspberryPi 3
@Juicepress that exception you've posted here is exactly why you need ARM version of it. If you switch to version I pre-built and deployed to my repository it *should* work. Any issues let me know. At some point I should make new build with the latest version of LibGDX again. Hopefully this time it is going to be simpler O: )
-
- Posts: 7
- Joined: Mon Jan 16, 2017 8:01 pm
Re: libGDX on raspberryPi 3
So i just went through ur tutorial and i basically understood the idea behind jogl. U basically replace the lwjgl window with a jogl window right? I also read a bit about gradle but im still a bit confused.clicky wrote:@Juicepress that exception you've posted here is exactly why you need ARM version of it. If you switch to version I pre-built and deployed to my repository it *should* work. Any issues let me know. At some point I should make new build with the latest version of LibGDX again. Hopefully this time it is going to be simpler O: )
I changed my build.gradle to get jogl but unfortunately i still cant use it. Like the import "import com.badlogic.gdx.backends.jogamp.JoglNewtApplication;" doesnt work for me.
Code: Select all
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "my-gdx-game"
gdxVersion = '1.9.5'
roboVMVersion = '2.3.0'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "http://repository.abstracthorizon.org/maven2/abstracthorizon.snapshot/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-backend-jogamp:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
This is my build.gradle atm. Is this because im using the newest version of libgdx? Or i am just stupid haha
I also tried to download ur example project but i cant open it since eclipse doesnt find the project.
Hopefully u can help me. Thanks!
EDIT: I also installed Buildship Gradle Integration 2.0 from eclipse marketplace
Re: libGDX on raspberryPi 3
There is only one built version at the moment: 1.9.5.rpi-SNAPSHOT
Line:
Line:
Hopefully that will get you going."Next is for 'allprojects\ext\gdxVersion' to have new value: '1.9.5.rpi-SNAPSHOT'. That's one of the snapshots (currently a build from the source as of week starting on 17th October 2016) of LibGDX with 'bits'(**)."
-
- Posts: 7
- Joined: Mon Jan 16, 2017 8:01 pm
Re: libGDX on raspberryPi 3
Aight,gradle worked for me. I was able to run gradlew.bat
I just copied ur build.gradle into my own project and and the bat worked without any problems.
Unfortunately im still not able to import

Sorry for bothering u that much btw..
EDIT: I even managed to get ur example project into eclipse.. Even there it cant import
I just copied ur build.gradle into my own project and and the bat worked without any problems.
Unfortunately im still not able to import
Code: Select all
import com.badlogic.gdx.backends.jogamp.JoglNewtApplication;

Sorry for bothering u that much btw..
EDIT: I even managed to get ur example project into eclipse.. Even there it cant import
Code: Select all
import com.badlogic.gdx.backends.jogamp.JoglNewtApplication;
Re: libGDX on raspberryPi 3
Yeah, that's my fault. Sorry. You need to add:
compile "com.badlogicgames.gdx:gdx-backend-jogamp:$gdxVersion"
next (after? instead?)
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
in project(":desktop") dependencies section. I'll update original post.
BTW I've followed my instructions and default example as produced by gdx-setup.jar works on my laptop and Eclipse.
compile "com.badlogicgames.gdx:gdx-backend-jogamp:$gdxVersion"
next (after? instead?)
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
in project(":desktop") dependencies section. I'll update original post.
BTW I've followed my instructions and default example as produced by gdx-setup.jar works on my laptop and Eclipse.
Re: libGDX on raspberryPi 3
Look what I've found: https://github.com/natdan/rpi-libgdx-example
That has all the details you would need to run LibGDX on RPi
That has all the details you would need to run LibGDX on RPi

-
- Posts: 7
- Joined: Mon Jan 16, 2017 8:01 pm
Re: libGDX on raspberryPi 3
I dont know,i literally copied ur project.gradle and the project.gradle from the example u linked. I even got that example u linked in my eclipse but still.. i cant import jogamp.
https://gyazo.com/9d927c7535f03531356608fd7f9b21b4
Is there any way to install those libraries manuelly?
https://gyazo.com/9d927c7535f03531356608fd7f9b21b4
Code: Select all
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "my-gdx-game"
gdxVersion = '1.9.5.rpi-SNAPSHOT'
roboVMVersion = '2.3.0'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "http://repository.abstracthorizon.org/maven2/abstracthorizon.snapshot/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile 'org.java-websocket:Java-WebSocket:1.3.0'
compile 'com.ning:async-http-client:1.9.33'
compile 'org.slf4j:slf4j-api:1.7.14'
compile 'org.slf4j:slf4j-simple:1.7.14'
compile "com.badlogicgames.gdx:gdx-backend-jogamp:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers-desktop:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers-platform:$gdxVersion:natives-desktop"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
Re: libGDX on raspberryPi 3
After amending project.gradle you need to right click on the project(s) (grouped up projects? or repeat for each individually) and select 'Update All' for gradle Eclipse plugin to update class paths.
Alternative is to drop them from Eclipse (delete) and re-import it.
Another idea is to check out example project in separate dir and import it as a new project and see if it works.
Alternative is to drop them from Eclipse (delete) and re-import it.
Another idea is to check out example project in separate dir and import it as a new project and see if it works.
-
- Posts: 7
- Joined: Mon Jan 16, 2017 8:01 pm
Re: libGDX on raspberryPi 3
clicky wrote:After amending project.gradle you need to right click on the project(s) (grouped up projects? or repeat for each individually) and select 'Update All' for gradle Eclipse plugin to update class paths.
Alternative is to drop them from Eclipse (delete) and re-import it.
Another idea is to check out example project in separate dir and import it as a new project and see if it works.
Yea,i refreshed the project. Still not able to import. Gradle is working tho
Made a quick Video! Used the project.gradle from the example Project u linked.
https://www.youtube.com/watch?v=wcKWsWB ... tu.be&hd=1
Dunno where my mistake is

Re: libGDX on raspberryPi 3
Hi,
I've watched your video and I think I know where you might have made a mistake:
1. you 'created' LibGDX project over existing sources
2. asked setup program to create eclipse files
3. then you amended build.gradle
4. then you imported it in Eclipse as 'Eclipse project'
Now, there are two bits that cause the issue: you did 2. before 3. Consequence is that setup has created eclipse projects (more importantly .classpath - visible in Eclispe as 'Referenced Libraries') *before* you amended build.gradle.
Second thing is that, then, you imported 'stale' Eclipse project (created before you amended build.gradle) in Eclipse and imported it as 'static' Eclipse project.
There are two different ways to fix it. One is to find a way how to 're-create' eclipse projects from gradle and second is to import project as 'Gradle' project - not 'Eclipse' project.
So, second way may be done like this:
If you use 'Import'/'Gradle (STS)'/'Gradle project', select your 'test' dir, click on Build Model and let Eclipse + Gradle (STS) do the rest. Then you can right click on (desktop?) project, select Gradle (STS)/Refresh All and it will refresh dependencies (visible in Eclipse as 'Gradle Dependencies (persisted)' and you'll be able to use new dependency you have added to build.gradle.
If you insist using 'static' 'Eclipse' project (first way) I propose slightly roundabout way:
Import my example (rpi-libgdx-example) using the way above (as Gradle (STS) project) and when all is in and fine expand that 'Gradle Dependencies' and add all jogl-all and any other needed to your Eclipse project one by one (right click on project, 'Build Path'/'Add External Archives...').
I am sure that there is another way of enticing gradle to 're-build' Eclipse project from build.gradle file, but I never used it, especially not on Windows (which I don't have for last 12 years at least).
Let me know how did it go!
I've watched your video and I think I know where you might have made a mistake:
1. you 'created' LibGDX project over existing sources
2. asked setup program to create eclipse files
3. then you amended build.gradle
4. then you imported it in Eclipse as 'Eclipse project'
Now, there are two bits that cause the issue: you did 2. before 3. Consequence is that setup has created eclipse projects (more importantly .classpath - visible in Eclispe as 'Referenced Libraries') *before* you amended build.gradle.
Second thing is that, then, you imported 'stale' Eclipse project (created before you amended build.gradle) in Eclipse and imported it as 'static' Eclipse project.
There are two different ways to fix it. One is to find a way how to 're-create' eclipse projects from gradle and second is to import project as 'Gradle' project - not 'Eclipse' project.
So, second way may be done like this:
If you use 'Import'/'Gradle (STS)'/'Gradle project', select your 'test' dir, click on Build Model and let Eclipse + Gradle (STS) do the rest. Then you can right click on (desktop?) project, select Gradle (STS)/Refresh All and it will refresh dependencies (visible in Eclipse as 'Gradle Dependencies (persisted)' and you'll be able to use new dependency you have added to build.gradle.
If you insist using 'static' 'Eclipse' project (first way) I propose slightly roundabout way:
Import my example (rpi-libgdx-example) using the way above (as Gradle (STS) project) and when all is in and fine expand that 'Gradle Dependencies' and add all jogl-all and any other needed to your Eclipse project one by one (right click on project, 'Build Path'/'Add External Archives...').
I am sure that there is another way of enticing gradle to 're-build' Eclipse project from build.gradle file, but I never used it, especially not on Windows (which I don't have for last 12 years at least).
Let me know how did it go!

Re: libGDX on raspberryPi 3
I'd like to let you know that I managed to run the sample project provided by clicky via gradle
./gradlew
run
In order to use this you have to fix the main class property
in desktop/build.gradle
After that you can run it on a rasperry pi, altough it doesn't seem stable for larger libgdx games.
./gradlew
In order to use this you have to fix the main class property
in desktop/build.gradle
Code: Select all
project.ext.mainClassName = "org.ah.libgdx.rpi.desktop.TestDesktopLauncherJogl"
-
- Posts: 7
- Joined: Mon Jan 16, 2017 8:01 pm
Re: libGDX on raspberryPi 3
Ohh,im dumb.
Thanks for explaining me everything. It was the first time i worked with gradle. Its working now! Thanks u so much
Thanks for explaining me everything. It was the first time i worked with gradle. Its working now! Thanks u so much

Re: libGDX on raspberryPi 3
Wonderful! 
Out of interest can you share what are you doing with LibGDX on RPi?

Out of interest can you share what are you doing with LibGDX on RPi?
