SWT support in LWJGL

Started by elias, December 20, 2003, 11:49:09

Previous topic - Next topic

elias

Hi,

Fbi did an excellent job of implementing a SWT Canvas with OpenGL support. Here's his mail:

Quote
as I anticipated on the javagaming.org forum I send you a snapshot of the
Windows version of the code to integrate SWT and LWJGL.
I will offline during all this weekend (sorry for that) so I will read any
of your comments on Monday ;-)
Anyway...some cues about the additions I made:

1) I added a couple of files in the native code responsible for the SWT
Canvas manipulation
2) I added a throwOpenGLException() function in commontools.cpp
3) I didn't compile the project against directInput because I did not have a
recent version of DX9 SDK installed on my machine...but it should be no
problem to add the files related to DirectInput (and it should cause no
harm).
4) The main java class is org.lwjgl.opengl.GLCanvas.
5) There's a small test named org.lwjgl.test.opengl.Sweet.


- elias

elias

Fbi, could you post the files online someplace for others to see too? My initial comments are:

1. I should keep the amount of JNIEnv usage to a minimum, thus code like:

               hdcField = env->GetFieldID(cls, "hDC", "I");
               hDC=(HDC)env->GetIntField(obj, hdcField);
               wglMakeCurrent(hDC,handle);

should read

               wglMakeCurrent(hDC,handle);

and have the hDC as an explicit argument to the native function.

2. The code depends on SWT to compile (of course). We should either be able to conditionally build the SWT part or have the needed SWT classes included in the LWJGL distribution.

Other than that, it seems like a simple enough addition for us to add the LWJGL.

- elias

fbi

OK...I'm gonna reduce JNI overhead and, by the way, I believe that distributing SWT with LWJGL should cause no license problem.
I will investigate a little bit and then let you know.
I will not be online a lot during these Xmas days but I'll go on developing...don't worry  :D
It's just because I changed my residence and I ain't got a Internet connection still (it will be my Xmas gift)  :lol:

fbi

Oh yeah...about posting the code somewhere...as soon as I fix the Windows version and modify this to have a Linux version I post them both.
I hope to get them ended (and cleaned) in the very beginning of January (the first week I mean)  :D