Java Bindings for OpenGL 1-JOGL Introduction and Installation __java

Source: Internet
Author: User
JOGL is an abbreviation of Java bindings for OpenGL, which allows users to invoke OpenGL functions through the API in Java, thus writing hardware-supported 3D programs in Java.
For users who are familiar with OpenGL, JOGL is very easy to get used to, because most statements and OpenGL are exactly the same.

Installation of JOGL:
JOGL is not included in the Sun's Java package because it has no official version. To install JOGL, the user must install them manually.
Before installing JOGL, users must first install Sun's Java 1.4.2 version.

Because of the manual installation, there may be some differences between the operating systems. Download JOGL library files are also available on various websites. The following is I think the relative full text of the Jogl file download address: https://jogl.dev.java.net/servlets/ProjectDocumentList

Although there are differences in versions, there are 2 files that are essential, one is Jogl.jar file to provide the Jogl API, and the other is called native file, which varies according to different operating systems. The primary function is to provide communication calls between Java and the operating system's OpenGL library.

Mac OS x users:
I am using Jogl.jar and libjogl.jnilib files. Copy the 2 files to the System->library->java->extensions directory. Even if the installation is basically complete, Eclipse and Xcode can automatically recognize its path.

Windows User:
According to my own experience, Windows user installation Jogl, and most of the articles written a little bit of access.
Windows users will need Jogl.jar and Jogl.dll 2 files to copy files to C:/>program File->java->j2re1.42_11 (depending on the Java version of the individual installation, different.)- >bin and Lib directories. Instead of the most articles mentioned, copy to the Java installation directory.

After the installation completes, run the following program, if the failure of the output is not realistic any error message, the installation is successful.

Import net.java.games.jogl.*;

public class HelloWorld
{
public static void Main (String arg[])
{
Try
{
System.loadlibrary ("Jogl");
System.out.println ("Hello World"); If the reality Hello world, the Jogl native Lib installation was successful.
Glcapabilities caps = new glcapabilities ();
System.out.pringln ("Hello jogl"); If the reality Hello JOGL description can be called normally.
}
catch (Exception e)
{
System.out.println (e);
}
}
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.