Following my last idea about an OSGi based game engine, I thought I'd start experimenting with various game engine stuff. So far, I've managed to get a bundle that has OpenGL binding working quite nicely. I used LWJGL, and created two bundles for it:
1) org.lwjgl -- the Java classes and source code is in this bundle.
2) org.lwjgl.win32 -- platform specific fragment for the above bundle, which has the Windows DLL-s and OSGi knows how to load them because I specified the Bundle-NativeCode header for them in the manifest.
I used the SWT OpenGL support to test this and after experimenting with some snippets, and copying some code from the famous NeHe OpenGL tutorials, I thought that since I was using Java 5, I could do the following:
import static org.lwjgl.opengl.GL11.*;
to import the static methods and lo and behold -- now I can paste the C code from NeHe tutorials into Java files without making any changes! :)
Now I'm getting the urge to start learning OpenGL again. I've already done some of the NeHe tutorials in C++, but I never really liked to write code in C or C++ that much.
Wednesday, November 22, 2006
Subscribe to:
Posts (Atom)