Working full screen LWJGL


13 posts
by spsn » Wed Nov 07, 2012 7:55 pm
I have managed to build a version of LWJGL 2.8.4 for armhf RasPi that works in full screen mode. I have started to look at windowed mode, but made no real progress there.

For a demo of LWJGL in action, look here: viewtopic.php?f=78&t=22341

The LWJGL jars and native armhf libraries are included with the demo.
User avatar
Posts: 68
Joined: Wed Nov 07, 2012 6:33 pm
by spsn » Wed Nov 07, 2012 10:12 pm
Oh, yes. This version of LWJGL uses the hardware acceleration provided by the GPU on the dispmanx surface, as seen in the examples provided in /opt/vc.
User avatar
Posts: 68
Joined: Wed Nov 07, 2012 6:33 pm
by princec » Thu Nov 08, 2012 9:56 pm
hang on, how do we use hardfloat with the JVM?

Cas :)
Posts: 28
Joined: Fri Sep 02, 2011 11:01 am
by princec » Thu Nov 08, 2012 10:02 pm
... ah wait, you're using OpenJDK and JamVM :( Still waiting for proper Hotspot VM + hardfloat here before I get my hands dirty.

Cas :)
Posts: 28
Joined: Fri Sep 02, 2011 11:01 am
by spsn » Thu Nov 08, 2012 10:11 pm
We can't use the Oracle JVM with hard float yet and this version of LWJGL is only for hard float, so OpenJDK Zero and jamvm are the options available. jamvm is quite a bit faster than Zero so I use that on my RasPi. I wish cacao was available with hard float because that gives a nice boost over jamvm again.

I am busy preparing my other RasPi with soft float Wheezy so I can build a soft float version of LWJGL 2.8.4 so that those who prefer the Oracle JVM can also get the hardware acceleration goodness to play with. Give me a couple of days.
User avatar
Posts: 68
Joined: Wed Nov 07, 2012 6:33 pm
by princec » Thu Nov 08, 2012 10:40 pm
That is absolutely awesome!

In this instance please do come and crosspost your stuff at java-gaming.org and lwjgl.org forums - lots of interested people in there.

Cas :)
Posts: 28
Joined: Fri Sep 02, 2011 11:01 am
by xranby » Thu Nov 08, 2012 10:49 pm
And yes Blocky is running 60fps 1080p using #JamVM + #OpenJDK + #LWJGL + #Rasbian #armhf on my #RaspberryPi !
viewtopic.php?f=78&t=22341

I did not find the LWJGL source changes in any of the published blocky.tgz or the blocky-src.zip
It would be great to get the raspberry pi specific dispmanx initialization into the upstream LWJGL opengles svn.

Kudos for a nice demonstration!
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby
User avatar
Posts: 401
Joined: Sat Mar 03, 2012 10:02 pm
by xranby » Fri Nov 09, 2012 1:12 pm
spsn wrote:We can't use the Oracle JVM with hard float yet and this version of LWJGL is only for hard float, so OpenJDK Zero and jamvm are the options available. jamvm is quite a bit faster than Zero so I use that on my RasPi. I wish cacao was available with hard float because that gives a nice boost over jamvm again.

I am busy preparing my other RasPi with soft float Wheezy so I can build a soft float version of LWJGL 2.8.4 so that those who prefer the Oracle JVM can also get the hardware acceleration goodness to play with. Give me a couple of days.


You will need to add a runtime armel/armhf autodetection to LWJGL so that LWJGL load the correct native library.
how to determine armel vs armhf: viewtopic.php?f=33&t=20873&p=201219
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby
User avatar
Posts: 401
Joined: Sat Mar 03, 2012 10:02 pm
by spsn » Fri Nov 09, 2012 5:05 pm
Right. I have set up a github repository for LWJGL for RasPi, here:
Code: Select all
https://github.com/spsn/lwjgl

In there you will find a file that lists the changes that I applied to my RasPi after I extracted the stock lwjgl-2.8.4 archive, and the 2 source files that I changed to get the rendering working on the RasPi in full screen mode. Look for the @@spsn tags in the files.

In the repository you will also find 2 archive files with jars and libraries to use for building and running your applications on the RasPi; one for soft float (armel) and one for hard float (armhf).
User avatar
Posts: 68
Joined: Wed Nov 07, 2012 6:33 pm
by X86_Dev » Sat Dec 08, 2012 8:18 pm
Is this also working on a chroot-ed Linux besides Android?

So can I play Minecraft (PC Edition) on a Android device too?
Many thanks for your answer!
Posts: 1
Joined: Sat Dec 08, 2012 8:11 pm
by malakai » Sat Dec 08, 2012 8:59 pm
This isn't intended to interface with Minecraft it opens up full screen capabilities for LWJGL on the Pi.
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)
User avatar
Posts: 1383
Joined: Sat Sep 15, 2012 10:35 am
by jimmis98 » Sat Dec 08, 2012 9:20 pm
This isn't intended to interface with Minecraft it opens up full screen capabilities for LWJGL on the Pi.
by malakai

Really, I was thinking of trying to use LWJGL with Minecraft PC edition on Raspberry Pi (even though there will soon be an official PI edition), so I would be grateful to be informed about the reasons for which minecraft cannot interface with it.
Posts: 20
Joined: Wed Aug 15, 2012 10:11 am
by malakai » Sat Dec 08, 2012 10:30 pm
Yes really. A simple search on the forums will result in over 611 posts in regards to Minecraft http://www.raspberrypi.org/phpBB3/search.php?keywords=Minecraft these all indicate that the limitations of running the PC version on the Pi is a hardware issue not software. Can this be used if replacing the LWJGL that is incorporated into the game possibly. But it will never over come hardware limits. The simple idea that the game's creators didn't simply just write up a bit of code to run the full version vs writing a complete game based on the portable Minecraft would in itself show it's not possible. If you have other hardware that has OpenGL support (the Pi does not) has something closer to a 1Ghz processor compared to the Pi's similarity to a 300Mhz processor and comes with 1GB of ram dedicated to the CPU and about 128Mb dedicated to video has a Linux Distro based on the armhf then maybe this could help.

The objective of why it may or may not interface with Minecraft is a different subject and should probably be in it's own post so as not to hijack this one. But ultimately it's a process of futility because even if it were to load the splash screen how do you overcome OpenGL with OpenGL ES along with the hardware limitations which are written into the source of the game.
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)
User avatar
Posts: 1383
Joined: Sat Sep 15, 2012 10:35 am