How to use JOGL with OSGI

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use JOGL with OSGI

Daniel S.
Hi,

I'm trying to develop an application with JOGL and the OSGi framework concierge.

But I'v got some problems to start my OSGI framework with JOGL because of the native code libs of JOGL.

Have anybody developed an OSGI application with JOGL or other librarys which contain native code and can give me a short example how to include my native libs?

 Currently my project contains a folder librarys with the extracted JOGL jars (these has to be extracted because of the Concierge specifications in matter of the class loading aspect in OSGI) and the .dll files.

My OSGi manifest file looks like:

...
Bundle-RequiredExecutionEnvironment: OSGi/Minimum-1.0
Import-Package: org.osgi.framework;specification-version="1.5.0
Bundle-NativeCode: librarys/gluegen-rt.dll ; osname=Win32; processor=x86,
 librarys/nativewindow_awt.dll; osname=Win32; processor=x86
Bundle-ClassPath: librarys/com/,
 librarys/javax/

Thanks in advance

Daniel
Reply | Threaded
Open this post in threaded view
|

Re: How to use JOGL with OSGI

gouessej
Administrator
Hi!

I use OSGI in Eclipse. I create 2 fragments, one for the JARs, one for the natives. When I launch an Eclipse configuration, I choose the fragment containing the JARs and the fragment containing the natives for my platform. I don't need to use Bundle-NativeCode, I use Export-Package, Bundle-ClassPath and Fragment-Host:

Bundle-ClassPath: lib/gluegen-rt.jar,
 lib/jogl.all.jar,lib/nativewindow.all.jar,lib/newt.all.jar
 .
Export-Package: com.jogamp.common,
 com.jogamp.common.jvm,
 com.jogamp.common.nio,
 com.jogamp.common.os,
 com.jogamp.common.util,
 com.jogamp.opengl.impl,
 com.jogamp.opengl.util,
 com.jogamp.opengl.util.awt,
 com.jogamp.opengl.util.gl2,
 com.jogamp.opengl.util.glsl,
 com.jogamp.opengl.util.glsl.fixedfunc,
 com.jogamp.opengl.util.glsl.fixedfunc.impl,
 com.jogamp.opengl.util.glsl.sdk,
 com.jogamp.opengl.util.packrect,
 com.jogamp.opengl.util.texture,
 com.jogamp.opengl.util.texture.awt,
 com.jogamp.opengl.util.texture.spi,
 com.jogamp.opengl.util.texture.spi.awt,
 javax.media.opengl,
 javax.media.opengl.awt,
 javax.media.opengl.fixedfunc,
 javax.media.opengl.glu,
 javax.media.opengl.glu.gl2,
 javax.media.opengl.glu.gl2es1
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to use JOGL with OSGI

Wade Walker
Administrator
In reply to this post by Daniel S.
The tutorial at http://wadeawalker.wordpress.com/2010/10/09/tutorial-a-cross-platform-workbench-program-using-java-opengl-and-eclipse/ shows how to build a JOGL app within Eclipse. The OSGI metadata is in the META-INF/MANIFEST.MF files of each project.

You don't have to go through the whole tutorial to take a look; you can just download the projects from

http://wadeawalker.files.wordpress.com/2010/10/jogl-projects-zip-not-a.doc
http://wadeawalker.files.wordpress.com/2010/10/t1-project-zip-not-a.doc

Rename them to zip files, then unzip and look inside META-INF/MANIFEST.MF for each project.

There's one manifest for each JOGL platform, one for the overall JOGL project, and one for the main project.
Reply | Threaded
Open this post in threaded view
|

Re: How to use JOGL with OSGI

Daniel S.
Hi

thank you very much for your help and the tutorial.

Now it works fine with Eclipse.

Unfortunately the Concierge Framework doesn't support fragments.

Has anyone an idea how to set up a concierge project which works with JOGL.

I'd like to use concierge because my application should be runnable on moblie devices an the Concierge framework is optimized for mobile devices but it doesn't support all features like the Equinox framework.

Thanks in advance

Daniel

Reply | Threaded
Open this post in threaded view
|

Re: How to use JOGL with OSGI

Wade Walker
Administrator
Daniel S. wrote
Unfortunately the Concierge Framework doesn't support fragments.
Hi Daniel,

I haven't used the Concierge framework, but I can think of two possible solutions:

1. If you only have to run on one platform, you can remove the JOGL fragment projects, then put the .dll/.so files from that one platform into the one remaining JOGL main project. Put the "platform filter" string from the platform you want into the JOGL main project too.

2. If you still have to be cross-platform, you might be able to remove the main JOGL project, put the .jar files into all the JOGL fragment projects, then convert the fragments to "full" projects. This loses the advantage of only having to include the .jar files once, but it might work.