Newbie question regarding current LWJGL context

Started by fred_em, November 29, 2010, 13:36:19

Previous topic - Next topic

fred_em

Hi,

I have an application written in Java and C++. The rendering loop is managed on the C++ side.
Part of the rendering loop is calling back from C++ into Java - I have the necessary JNI layering code for this.

When I am inside a Java callback, wglMakeCurrent (on the C++ side) has already been called.

In my Java callback function called from C++, I tried calling glBlendFunc() or other OpenGL functions but I get a NullPointerException.
I believe there is something that I must do in order for LWJGL to work, like initialize something.

What shall I do to get started?

Thanks
-F

spasi

Hi fred_em,

You need to call GLContext.useContext(Object) after the wglMakeCurrent call on the C++ side. Both calls must be executed in the same thread and the Object argument can be any object that uniquely identifies your externally managed context (make sure .hashCode() returns something sensible, the object will be stored in a HashMap in LWJGL). You should be able to use the LWJGL API without problems after that.

fred_em

Thanks, it works.

However, I have another, more serious issue that may prevent me from using LWJGL.