Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Design  





2 Status and standardization  





3 Java2D-OpenGL interoperability  





4 Code example  





5 See also  





6 References  





7 External links  














Java OpenGL






Deutsch
Español
Français

Հայերեն
Italiano
עברית
Nederlands

Polski
Русский
 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 




Print/export  



















Appearance
   

 






From Wikipedia, the free encyclopedia
 


This is an old revision of this page, as edited by Sam Hocevar (talk | contribs)at09:55, 12 September 2012 (shortened example; it's an _example_, not a tutorial). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff)  Previous revision | Latest revision (diff) | Newer revision  (diff)

JOGL (JSR-231)
Developer(s)JogAmp Community
Stable release

1.1.1 / May 22, 2008; 16 years ago (2008-05-22)

Preview release

2.0-rc9 / June 20, 2012; 12 years ago (2012-06-20)

Operating systemCross-platform
Type3D computer graphics software (library/API)
LicenseBSD license
Websitejogamp.org

Java OpenGL (JOGL) is a wrapper library that allows OpenGL to be used in the Java programming language[1][2]. It was originally developed by Kenneth Bradley Russell and Christopher John Kline, and was further developed by the Sun Microsystems Game Technology Group. Since 2010, it has been an independent open source project under a BSD license. It is the reference implementation for Java Bindings for OpenGL (JSR-231).

JOGL allows access to most OpenGL features available to C language programs through the use of Java Native Interface (JNI). It offers access to both the standard GL* functions along with the GLU* functions; however the OpenGL Utility Toolkit (GLUT) library is not available for window-system related calls, as Java has its own windowing systems: Abstract Window Toolkit (AWT), Swing, and some extensions.

Design

The base OpenGL C API, as well as its associated Windowing API[3], are accessed in JOGL via Java Native Interface (JNI) calls. As such, the underlying system must support OpenGL for JOGL to work.

JOGL differs from some other Java OpenGL wrapper libraries in that it merely exposes the procedural OpenGL API via methods on a few classes, rather than trying to map OpenGL functionality onto the object-oriented programming paradigm. Indeed, most of the JOGL code is autogenerated from the OpenGL C header files via a conversion tool named GlueGen, which was programmed specifically to facilitate the creation of JOGL.

This design decision has both its advantages and disadvantages. The procedural and state machine nature of OpenGL is inconsistent with the typical method of programming under Java, which is bothersome to many programmers. However, the straightforward mapping of the OpenGL C API to Java methods makes conversion of existing C applications and example code much simpler. The thin layer of abstraction provided by JOGL makes runtime execution quite efficient, but accordingly is more difficult to code compared to higher-level abstraction libraries like Java3D. Because most of the code is autogenerated, changes to OpenGL can be rapidly added to JOGL.

Status and standardization

As of 2007, JOGL provides full access to the OpenGL 2.0 specification. The last 1.1.0 version is the reference implementation for JSR-231 (Java Bindings for OpenGL)[4]. The 1.1.1 release gives limited access to GLU NURBS, providing rendering of curved lines and surfaces via the traditional GLU APIs.

Version 2.0 is currently in development, which includes a minor API refactoring and support for OpenGL profiles GL 1.3 - 3.0, GL 3.1 - 3.3, GL ≥ 4.0, ES 1.x and ES 2.x.

Java2D-OpenGL interoperability

Since the Java SE 6 version of the Java language, Java2D (the API for drawing two dimensional graphics in Java) and JOGL have become interoperable, allowing it to :

Code example

This example code snippet shows how the conventional C style API would be used through JOGL in a hypothetical display() class method. It uses the deprecated fixed-function pipeline for the sake of simplicity.

// Required imports.
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;

// Example method: clear the framebuffer and draw a quad.
public void display(GLAutoDrawable gLDrawable) {
    final GL2 gl = gLDrawable.getGL().getGL2();
    gl.glClear(GL.GL_COLOR_BUFFER_BIT);
    gl.glClear(GL.GL_DEPTH_BUFFER_BIT);

    gl.glBegin(GL2.GL_QUADS);       
        gl.glColor3f(0.0f, 1.0f, 1.0f); // Set the color of the quad
        gl.glVertex2f(-1.0f, 1.0f);     // Top left
        gl.glVertex2f( 1.0f, 1.0f);     // Top right
        gl.glVertex2f( 1.0f,-1.0f);     // Bottom right
        gl.glVertex2f(-1.0f,-1.0f);     // Bottom left
    gl.glEnd();                                                     
}

See also

References

  1. ^ "Open source Java projects: Java Binding for OpenGL (JOGL)". JavaWorld. 2008-09-18. Retrieved 2011-02-06. JOGL originated as a project named Jungle, which was created by 3D graphics experts Ken Russell (of Sun Microsystems) and Chris Kline (of Irrational Games).
  • ^ "Hello JOGL". JavaWorld. 2005-02-21. Retrieved 2011-02-06.
  • ^ "3D & Multimedia Across Platforms and Devices Using JOGL" (PDF). SIGGRAPH. 2010-07-27. Retrieved 2011-02-06.
  • ^ "JSR-000231 Java Bindings for the OpenGL API". Java Community Process. Retrieved 2011-02-06. In order to facilitate maximum community participation for the Java Binding for the OpenGL API, we use the JOGL project on java.net found at https://jogl.dev.java.net. The JOGL source code can be found there, licensed under a liberal source code license (mostly licensed as BSD except where we use other parties' licensed code). We take a snapshot of the code from this project every few months, run the Technology Compatibility Kit on the source code, and then officially make it the Reference Implementation for each formal Java Binding for the OpenGL API release.
  • External links


    Retrieved from "https://en.wikipedia.org/w/index.php?title=Java_OpenGL&oldid=511987093"

    Categories: 
    Java platform
    3D graphics software
    Java APIs
    Java libraries
    Hidden categories: 
    Pages using deprecated source tags
    Articles with too many examples from August 2010
    All articles with too many examples
    Wikipedia articles with style issues from August 2010
    Official website different in Wikidata and Wikipedia
     



    This page was last edited on 12 September 2012, at 09:55 (UTC).

    This version of the page has been revised. Besides normal editing, the reason for revision may have been that this version contains factual inaccuracies, vandalism, or material not compatible with the Creative Commons Attribution-ShareAlike License.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki