Linux framebuffer implementation

Started by princec, June 20, 2012, 21:11:20

Previous topic - Next topic

princec

So... I'm a bit behind the times with exactly how the Linux version of LWJGL implements the Display. Does it have any dependencies on AWT? If not, how does it all work and hang together?
And what about the OpenGL-ES part?

Cas :)

kappa

The Display on Linux is implemented almost entirely using Xlib. There is only a very tiny amount of AWT namely for the Display.setParent() (not used for standalone Display) and a few calls to JAWT's lock/unlock methods.

Not entirely sure why we even need all the lock/unlock calls (and thus dependence on JAWT) for LWJGL's Display to function. There is a note in LWJGL code stating the following:

Quote/* Since Xlib is not guaranteed to be thread safe, we need a way to synchronize LWJGL
    * Xlib calls with AWT Xlib calls. Fortunately, JAWT implements Lock()/Unlock() to
    * do just that.
    */

Could be that these calls are left over from a time when there was more AWT code in the Linux Display (which has since been replaced by Xlib?) but not really sure.

As far as OpenGL-ES part is concerned it seems to work fine (but needs to be self compiled as pre-compiled binaries aren't provided). Some people have shown examples of getting LWJGL-ES working on various embedded devices using OpenJDK.

princec

I ask because I'm having a pop at coding on my Raspberry Pi :) If at all possible I want to completely avoid X but it looks like LWJGL is at least dependent on X to function. There might be some merit in an SDL implementation - apparently SDL can go direct to the framebuffer and has no need of X to function. Though I wonder how keyboard and mouse input would then work.

Cas :)

kappa

ah ok, if you do eventually decided to use X, Java and LWJGL then you could try the instructions and binaries found here might help.

princec

I'm angling to avoid X because I think I want to try to use Oracle's headless JRE for performance reasons. Not least because X wastes a ton of memory which on the RPi you really do need. Using the headless JRE and SDL I reckon I'll have 128mb for the game and 30mb for textures - should be enough :)

Cas :)