-
-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Callback with JNIEnv and binding for JAWT #125
Comments
This should be fairly easy to implement. I'll work on it soon. |
You shouldn't hang out with those people 😝 |
@dustContributor |
Yeah I was implying JavaFX is a better option 😄 |
Implementing AWTGLCanvas with LWJGL3 on Windows and Linux shouldn't be too difficult. The real problem however is implementing it on OSX as there is currently no nice solution. It was really messy getting it working on LWJGL2 and IMO LWJGL3 would be better off just avoiding going down the same path again. |
Thanks a lot! This is a great solution. Especially with the implicit JNIEnv parameter not being exposed in Java. |
Yes, handling JNIEnv turned out nice. But there are a couple of issues, that's why I put jawt in the system package (i.e. subject to change in the future):
|
It seems like AWT/Swing is still a very popular solution for doing GUI programming in Java.
As such, the need for a LWJGL 3/AWT/Swing integration often arises.
Therefore, I'd like to revive LWJGL 2's AWTGLCanvas.
The only really headache is to get a hold of the platform-specific window handles of the AWT Canvas object.
It seems that JAWT is still a good solution for it. There are probably other solutions involving only reflection against fields of sun-specific AWT implementation classes (like mentioned by this stackoverflow entry: http://stackoverflow.com/questions/386792/in-java-swing-how-do-you-get-a-win32-window-handle-hwnd-reference-to-a-window).
But if JAWT is going to be used, I'd like to avoid writing native code.
For that, we would need some way to feedback the JNIEnv argument of a JNI function back to Java code by some means of a callback.
This is because I would like to access JAWT with only the platform/struct API exposed by LWJGL 3 with Java. But JAWT needs to be initialized and used through the JNIEnv object.
And in the future it may be useful for other JNI programming in pure Java/LWJGL 3, too, to be able to access the JNIEnv struct.
Could there be a way to callback into Java code with the address of the JNIEnv structure? I know that the JNIEnv argument cannot be cached between different JNI functions, so it must be a callback solution working in the same call stack.
Also, it would be good to have struct bindings for the JAWT core structs, such as JAWT_Win32DrawingSurfaceInfo (and equivalent).
The text was updated successfully, but these errors were encountered: