Friday, July 7, 2017

Install eclipse and configure it for Java OpenGL

When I was born, I knew nothing - anonymous

JRE library is required to run Eclipse so install JRE latest version.
·         Download a JogAmp library
If you haven't done so already, download and extract the JogAmp library you want to use.
For example, to download and extract JOGL, see the following instructions
1) Go to the site http://jogamp.org/deployment/jogamp-current/archive/jogamp-all-platforms.7z and download should automatically start. The zipped archive is about 54MB. If you are short of data balance, better to get the library (zipped file) from a friend.
2) Unzip the .7z file which is a zipped(compressed) file.
3) Only two jar files are all that is needed from this archive. They are glugen-rt.jar and jogl-all.jar.
4) If you are only working in windows download only these four jar files from my gdrive
·         Eclipse IDE project
Probably the simplest way to use JOGL in an Eclipse project is to create another Eclipse project to contain the JOGL JARs, then make your project depend on this new JOGL project. In the example below, I include only the 64-bit Windows native JARs, but you can put native JARs for as many platforms as you wish together into the JOGL Eclipse project.

1) Create a JOGL project

Put all the JOGL code JARs, native JARs for all platforms you wish to support, and source ZIP files in a directory called "JOGL" in your workspace directory.
Click "File > New > Java Project". Type "JOGL" as the project name and click "Next".


2) Click next and in the next page go to the tab libraries.
Click on add external jars. Then navigate to the folder where you have extracted the zip file in the previous step. In the jogamp-all-platforms folder go to the jar folder and add the jar files glugen-rt.jar and jogl-all.jar.


 3) Expand the jogl-all and gluegen-rt JARs. For each of them, double-click "Source attachment", click "Workspace...", navigate to the corresponding *-java-src.zip file in the project, select it, click "OK", and click "OK" again to dismiss the "Source Attachment Configuration" dialog. The JARs should look like this when you're done:

4) Click the "Order and Export" tab. Check both JOGL JARs, then click "Finish".

­
5) Create another java project and add dependency on the JOGL project

    Create another project, give a name and select next.  or if you have an existing project then
    Right-click your project and click "Properties".
    Select the "Java Build Path" on the left, then click the "Projects" tab on the right.
    Click the "Add..." button, check "JOGL", and click "OK".
    Your dependent project should look like this. Click "OK" to dismiss the "Properties" dialog.




That's it! Your project can now use the library.

No comments:

Post a Comment