Reputation: 1286
We have a Java application with a 2D graphics library that leverages OpenGL on the native C++ side. We make JNI calls into a DLL. Now I've been asked to make OpenGL work on the SWT side of the application, but to refrain from using JOGL or LWJGL or any other 3rd party GL binding. Can this be done, and how?
Upvotes: 1
Views: 323
Reputation: 9547
OpenGL is a C API implemented in opengl32.dll (or similar on unix), so you'll have to use it one way or the other.
IIRC, in order to be called from Java, functions in a dll must be called "Java_Classname_Functionname", which is obviously not the case of openGL functions.
If you really, really want to avoid LWJOGL, you'll have to create your own C DLL which redeclares all openGL functions with another signature (something like Java_MYJOGL_glClearColor instead of glClearColor), and which merely calls glClearColor...
Which is what LWJGL already does ( and also deals with platform-specific context creation & other stuff ).
If your company's concern is to avoid big unknown libraries, which is prefectly understandable, I'd advise you to stick with LWJGL, which is smaller that JOGL.
Upvotes: 1