Jni + lwjgl + jme

I am trying to integrate come JNI (C++) openGL code with a LWJGL application.



My situation is:

We have an application developed on the JME engine.

JME uses LWJGL.

A colleague has developed an openGL application in C++ which I have made a JNI implimentation of using an AWT Canvas.



My confusion comes on how to pass the same openGL context/reference/canvas which JME uses over to the JNI.



Here are some of my attempts:

I have stumbled on the getCanvas() method from StandardGame, but it would appear that this is not a supported feature because nothing uses this canvas (a look at the source reveals the canvas is never created)



I have also stumbled on the useContext() in GlContext.java (of LWJGL), in which case, could I use something to the effect of useContext(myStandardGame) ?



I would think if I could create a StandardGame with Canvas I'd have a solution but, I have been unable to instantiate a 'StandardGame' object that uses a Canvas (I modified StandardGame to use DISPLAY_MODE = DISPLAY_CANVAS). Here's the error:

[pre]

Nov 14, 2008 7:04:49 PM com.jme.input.joystick.DummyJoystickInput <init>

INFO: Joystick support is disabled

Nov 14, 2008 7:04:49 PM com.jme.system.lwjgl.LWJGLDisplaySystem <init>

INFO: LWJGL Display System created.

Nov 14, 2008 7:04:49 PM com.jmex.game.DefaultUncaughtExceptionHandler uncaughtException

SEVERE: Main game loop broken by uncaught exception

java.lang.NullPointerException

at com.jmex.game.StandardGame.initSystem(StandardGame.java:250)

at com.jmex.game.StandardGame.run(StandardGame.java:159)

at java.lang.Thread.run(Thread.java:619)

[/pre]



Even without an answer, any other guiding thoughts would be appreciated. I'm using JME 1.x

StandardGame and display mode canvas are broken right now (i'm not sure if it ever worked :slight_smile: ).

Someone else was fighting with it too : http://www.jmonkeyengine.com/jmeforum/index.php?topic=5341.msg74731#msg74731