Jump to content

[SOLVED] UNIGINE java integration


photo

Recommended Posts

We have to use java eclipse rich client platform (RCP) with SWT window toolkit for our data visualization application. There is already SWT GLCanvas support for native OpenGL rendering using JOGL "Java bindings for OpenGL", nevertheless I would prefere using UNIGINE engine for 3D canvas rendering

 

Is there any elegant way for integration of UNIGINE engine into java eclipse SWT windows toolkit ? Maybe something similar to the existing UNIGINE Android OpenGL ES integration which also integrates engine into java environment. Any help greatly appreciated.

Link to comment

Hi Ulf,

 

I'm not sure that what you want but for me the best way to use unigine with java, it's to make an Unigine::App using jni and native handle window.

The only matter is that doesn't work on osx, but on windows it's easy.

With java you can have acces to hwnd pointer, I just add an cpp file to Unigine with my own init/update/shutdown (the init take the app how parameter.) and inside my jni i load the unigine dll and wrap the three function.

 

 

Like that in java you write one thread who call init jni method, during the thread loop you call update jni and when you close your java window call shutdown.

 

I need take a look to my parralel work, but i think i have somethink like that working on windows.

 

For me, use this method, is great because doesn't need a lot of change inside Unigine, and woking with dll you can choose if you want a jar package with all inside dll ... script or if you prefer you can have something more dynamic your jar package dowload unigine dll and script inside the temp java file on the user computer like that the jar it's very little.

 

http://v3.actisku.com/inhouse/divers/jar/Crypt.jar here is a old demo working on mac only, but with cavaj app you can reverse the code to see the java code. Just unzip jar file and reverse .class file

 

When i found the old source i share if you want !!!!

 

Happy new year Ulf.

Link to comment

Hi Anthony, thanks for the input ! Would be great if you could share the code sample as this would for sure speed things up a lot. Happy new year and all the best for 2013 !

Link to comment

Hi Ulf, i put on the server my old java sources.

You can download the sources here :

 

http://test-player.actisku.com/tests/java/UnigineJava.zip

 

And you can try the x64 demo of crypt here :

 

 

http://test-player.actisku.com/tests/java/UnigineJava.jar (only for window x64 need java7update10 for x64)

 

Inside the zip file you will find two folder the jni part (with visual project) and java part (with netbeans project sorry i m not fan of Eclipse).

 

How i say it's an old code, and is missing part but all the foundation are here. The missing part are the keyboard / mouse / resize event. I just implement opengl app, will be interesting use directx for windows. This java code could work inside html page with an japplet.

 

If you have some memory problem, you can modify the parameter of java vm, like -Xss ....

 

If you have question ask me, i do this code very quickly. May be could be dark sometimes, but it have a lot of inspiration of unigine android portage.

Link to comment

Anthony, thank you very much ! The source was very helpful to get a feeling for the required efforts for such kind of integration. As we need a very thight bi-directional integration between java database part and the 3D visualization part I don't think it's feasible to further follow the idea to integrate UNIGINE as this will take too much time. Therefore I will stay with the native OpenGL approach based on JOGL. Thanks again for your support.

Link to comment
×
×
  • Create New...