开发者

How to bundle JOGL with NetBeans Platform?

I was going to use both JOGL and NetBeans platform. I开发者_高级运维 have trouble embedding JOGL native libs. Maybe there is a simple way to reuse .nbms from NetBeans OpenGL Plugin? Or any other way to do this?


Reusing NBMs from NetBeans OpenGL Pack should work at least for NetBeans 7.1. Have a look at this post: http://netbeans.dzone.com/nb-getting-started-jogl.

If you are using Maven, a quick solution is to create a wrapper module for JOGL and Gluegen with the following dependencies:

<dependencies>
    <dependency>
        <groupId>org.jogamp.jogl</groupId>
        <artifactId>jogl-all-main</artifactId>
        <version>2.0-rc9</version>
    </dependency>
    <dependency>
        <groupId>org.jogamp.gluegen</groupId>
        <artifactId>gluegen-rt-main</artifactId>
        <version>2.0-rc9</version>
    </dependency>
</dependencies>

It is essential to add the following public package definitions to the nbm-maven-plugin configuration:

<publicPackages>
    <publicPackage>com.jogamp.*</publicPackage>
    <publicPackage>javax.media.*</publicPackage>
    <publicPackage>jogamp.*</publicPackage>
</publicPackages>

I suppose a wrapper module can be created from NetBeans IDE, though I haven't tried that.


Without knowing specifically what your problem is, here's a way to just generally get JOGL running in Netbeans:

  1. Download a JOGL release that suits your platform. As of march 2011, grab one from http://jogamp.org/deployment/webstart/archive/, you'll want one file named "jogl-2.0-(build)-(date)-(platform).7z"

  2. Unzip it somewhere on your disk. I usually create a /sdk or c:\sdk and drop stuff there but that's up to you.

  3. Add the jars to your project. In Netbeans, you can create a "library" (Tools > Libraries) and add the jars there. Oh, and make sure you actually add this library to your project, right-click the "libraries" for your project. Probably you will do just fine adding these jars from the JOGL distribution:

    • gluegen-rt.jar
    • jogl.all.jar
    • nativewindow.all.jar
    • newt.all.jar
  4. In Eclipse you can add native files to a "library", but - afaik - you can't do this is Netbeans. You'll need to go in to the project properties and select "Run" on the left, and then add this Java VM option: "-Djava.library.path=/sdk/jogl/lib". Make sure to enter this as a VM option, not as arguments to the class. Also, of course replace /sdk/jogl with wherever you placed the files. And without the quotes, and no spaces anywhere.


Maybe try to use the JARs containing the native libraries as we do with Java Web Start.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜