Hello Guest

Linux framebuffer implementation

  • 4 Replies
  • 9265 Views
*

Offline princec

  • *****
  • 1933
    • Puppygames
Linux framebuffer implementation
« on: June 20, 2012, 21:11:20 »
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 :)

*

Offline kappa

  • *****
  • 1319
Re: Linux framebuffer implementation
« Reply #1 on: June 20, 2012, 22:26:52 »
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.
« Last Edit: June 20, 2012, 22:39:50 by kappa »

*

Offline princec

  • *****
  • 1933
    • Puppygames
Re: Linux framebuffer implementation
« Reply #2 on: June 20, 2012, 22:39:53 »
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 :)

*

Offline kappa

  • *****
  • 1319
Re: Linux framebuffer implementation
« Reply #3 on: June 20, 2012, 22:42:35 »
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.
« Last Edit: June 20, 2012, 22:53:28 by kappa »

*

Offline princec

  • *****
  • 1933
    • Puppygames
Re: Linux framebuffer implementation
« Reply #4 on: June 21, 2012, 07:31:46 »
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 :)