LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: elias4444 on June 29, 2008, 18:38:11

Title: Run LWJGL library without rendering?
Post by: elias4444 on June 29, 2008, 18:38:11
Long story short: I'm working on a dedicated server for my new game. I use LWJGL for more than just rendering (I use Vector3f, Sys.getTime(), etc.). Only problem is, LWJGL looks for a rendering platform when it's used. So, on say a linux server without xserver installed, I get an error even though I'm not opening a window or calling any openGL commands.

Is there a flag to turn this off? Or am I going to have to make my own software library for the server?
Title: Re: Run LWJGL library without rendering?
Post by: Matzon on June 29, 2008, 19:04:04
afaik, we do not support headless environment. I do not expect anyone to work on this, but you are welcome to create a patch to support it. It might be relatively easy to patch Sys to fallback to nothing when in an headless environment?
Title: Re: Run LWJGL library without rendering?
Post by: Matthias on June 29, 2008, 19:54:39
When you only want to use Vector3f you can do so when you don't call any of the Sys, Mouse, Keyboard, Display etc. classes.
Title: Re: Run LWJGL library without rendering?
Post by: elias4444 on June 29, 2008, 20:43:17
Yeah, I think it's the Sys class that's getting me. It's the only one I actually need to call since I use it my for timer. I'll just need to run the server with the java nanotime instead.  :-\
Title: Re: Run LWJGL library without rendering?
Post by: elias4444 on June 29, 2008, 21:36:44
Does anyone have any recent experience using nanotime() for their timer? I'm a little worried about performance from system to system. Does it run smooth across all platforms? Or do I need to find a way to make Sys.getTime() work for me?
Title: Re: Run LWJGL library without rendering?
Post by: Matzon on June 29, 2008, 22:00:23
its shit on multicore and more so on speedstep and similar.
Title: Re: Run LWJGL library without rendering?
Post by: elias4444 on June 29, 2008, 22:10:02
That's what I was afraid of. I'm dividing it to make it go milliseconds, and I'm going to leave the game client using the Sys.getTime() method.

BTW, why does Sys call the graphics system with getTime() and getTimerResolution() anyway?
Title: Re: Run LWJGL library without rendering?
Post by: Matzon on June 30, 2008, 05:15:04
Quote from: elias4444 on June 29, 2008, 22:10:02
BTW, why does Sys call the graphics system with getTime() and getTimerResolution() anyway?
it doesn't. It calls its SysImplementation is either a native implementation of one of these: WindowsSysImplementation, LinuxSysImplementation or MacOSXSysImplementation.

You may be able to override: LWJGLUtil.getPlatform() and Sys.createImplementation() to allow support for headless.
Title: Re: Run LWJGL library without rendering?
Post by: oNyx on June 30, 2008, 13:38:17
If it runs on a Linux server you can just use System.currentTimeMillis(). (Sys.getTime() just calls that method on Linux since it got an accuracy of 1msec.)