LWJGL and gcj

Anthony Green green@redhat.com
Wed May 25 07:32:00 GMT 2005


LWJGL provides another OpenGL binding for java among other things (see
lwjgl.org).  I was able to build it after a little jawt fixing (patch
coming soon).

Unfortunately it doesn't run.  They use a really nasty kludge that
doesn't work with gcj.  For some reason,they require access to low-level
graphics info in their java code.   The info they need isn't provided by
the high-level interfaces available to normal programs (like in
GraphicsDevice), so they use this trick to call methods on Sun's private
subclasses.

static int getScreenFromDevice(GraphicsDevice device) throws LWJGLException {
  try {
    Method getScreen_method = device.getClass().getMethod("getScreen", null);
    Integer screen = (Integer)getScreen_method.invoke(device, null);
    return screen.intValue();
 etc
 etc

They use this same trick to get a visualID from Sun's private
GraphicsConfiguration subclass.  

We will either have to implement similar secret interfaces, or ask the
LWJGL folks to change their ways (if that's even possible), or both.

I don't plan on doing anything more with this right now.  This was just
an FYI.

AG




More information about the Java mailing list