Java Bindings for OpenGL: Difference between revisions

Content deleted Content added
BattyBot (talk | contribs)
changed {{Unreferenced}} to {{Refimprove}} & general fixes using AWB (7916)
script-assisted date audit and style fixes per MOS:NUM
 
(9 intermediate revisions by 7 users not shown)
Line 1:
{{refimprove|date=August 2010}}
{{example farm|date=August 2010}}
{{Use mdy dates|date=March 2025}}
'''Java Binding for the OpenGL API''' is a [[Java Community Process|JSR]] [[API]] specification (JSR 231) for the [[Java SEPlatform, Standard Edition]] platform which allows to use [[OpenGL]] on the [[Java Platform(software platform)]].<ref>{{cite web
| url=http://jcp.org/en/jsr/detail?id=231
| title=JSR 231: JavaBinding for the OpenGL API
| publisher=[[Java Community Process]]
| accessdate=February 6, 2011-02-06}}</ref> There is also '''Java Binding for the OpenGL ES API''' (JSR 239) for the [[Java MEPlatform, Micro Edition]] platform.
 
== Programming concepts ==
Line 12 ⟶ 13:
All platform specific libraries (available from the [[Core OpenGL|CGL]] API for [[Mac OS X]], [[GLX]] for [[X Window System]], and [[WGL (software)|WGL]] for [[Microsoft Windows]]) are also abstracted out to create a platform independent way of selecting [[Framebuffer]] attributes and performing platform specific Framebuffer operations.
 
Platform-specific extensions are not included in the public API. Each implementation can choose to export some of these APIs via the [http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLBase.html#getPlatformGLExtensions%28%29 GL.getPlatformGLExtensions()] {{Webarchive|url=https://web.archive.org/web/20110217002436/http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLBase.html#getPlatformGLExtensions%28%29 |date=February 17, 2011 }} and [http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLBase.html#getExtension%28java.lang.String%29 GL.getExtension(String)] {{Webarchive|url=https://web.archive.org/web/20110217002436/http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GLBase.html#getExtension%28java.lang.String%29 |date=February 17, 2011 }} method calls which return Objects whose data types are specific to the given implementation.
 
==Example==
This example shows how to draw a polygon (without initialization or repaint code).<ref>Borrowed from the [http://nehe.gamedev.net/lesson.asp?index=01 Nehe tutorial] {{Webarchive|url=https://web.archive.org/web/20070406193934/http://nehe.gamedev.net/lesson.asp?index=01 |date=April 6, 2007 }}, whose code is free to use elsewhere.</ref> Here is the reference [[C (programming language)|C]] implementation:
<sourcesyntaxhighlight lang="c">
int DrawGLScene(GLvoid) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Line 36 ⟶ 37:
return TRUE;
}
</syntaxhighlight>
</source>
 
Which translates to the following [[Java (programming language)|Java]] implementation:
<sourcesyntaxhighlight lang="java">
public void display(GLAutoDrawable gLDrawableglDrawable) {
final GL gl = gLDrawableglDrawable.getGL();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
Line 59 ⟶ 60:
gl.glFlush();
}
</syntaxhighlight>
</source>
 
== Implementations ==
Line 66 ⟶ 67:
| title=JSR-000231 Java Bindings for the OpenGL API
| publisher=[[Java Community Process]]
| quote=''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.''
| accessdate=February 6, 2011-02-06}}</ref>
 
== See also ==
Line 74 ⟶ 75:
 
== References ==
{{Reflist|colwidth=30em}}
 
== External links ==
Line 81 ⟶ 82:
* [http://jogamp.org/ JOGL home page]
* [http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/overview-summary.html JSR 231 Specification (draft)]
 
{{Java desktop}}
 
{{DEFAULTSORT:Java Bindings For Opengl}}
[[Category:Java platform]]
[[Category:Java specification requests]]
[[Category:Java APIs]]