Java Bindings for OpenGL

Java Bindings for OpenGL

Java Binding for the OpenGL API is a JSR API specification for the Java SE platform which allows to use OpenGL [All functions in core OpenGL 2.0 have been included.] on the Java Platform.

Programming concepts

Core OpenGL API and GLU library calls are available from Java through a thin wrapper looking very much as the original OpenGL C API [Except GLU NURBS routines which are not exposed through the public API.] .

All platform specific libraries (available from the CGL API for Mac OS X, GLX for X Window System, and 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://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html#getPlatformGLExtensions() GL.getPlatformGLExtensions()] and [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html#getExtension() GL.getExtension(String)] method calls which return Objects whose data types are specific to the given implementation.] .

Example

This examples shows how to draw a Polygon (without initialization or repaint code) [Borrowed from [http://nehe.gamedev.net/lesson.asp?index=01 Nehe tutorial] , which code are free to use elsewhere] . Here is the reference C implementation : int DrawGLScene(GLvoid) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units glBegin(GL_TRIANGLES); //Drawing Using Triangles glVertex3f( 0.0f, 1.0f, 0.0f); // Top glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right glEnd(); glTranslatef(3.0f,0.0f,0.0f); glBegin(GL_QUADS); // Draw A Quad glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left glEnd(); glFlush(); return TRUE; }

Which translates to the following Java implementation : public void display( [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GLAutoDrawable.html GLAutoDrawable] gLDrawable) { final [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html GL] gl = [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GLAutoDrawable.html#getGL() gLDrawable.getGL()] ; gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); gl.glTranslatef(-1.5f, 0.0f, -6.0f); gl.glBegin(GL.GL_TRIANGLES); // Drawing Using Triangles gl.glVertex3f(0.0f, 1.0f, 0.0f); // Top gl.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left gl.glVertex3f(1.0f, -1.0f, 0.0f); // Bottom Right gl.glEnd(); gl.glTranslatef(3.0f, 0.0f, 0.0f); gl.glBegin(GL.GL_QUADS); // Draw A Quad gl.glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left gl.glVertex3f(1.0f, 1.0f, 0.0f); // Top Right gl.glVertex3f(1.0f, -1.0f, 0.0f); // Bottom Right gl.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left gl.glEnd(); gl.glFlush(); }

Implementations

*Java OpenGL : The reference implementation, available on Microsoft Windows, Linux, Mac OS X, and Solaris platforms.

References

See also

*OpenGL
*Java Community Process

External links

* [http://www.jcp.org/en/jsr/detail?id=231 JSR web page]
* [https://jogl.dev.java.net/ JOGL home page]
* [http://download.java.net/media/jogl/builds/nightly/javadoc_public/overview-summary.html JSR 231 Specification (draft)]


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • OpenGL — Original author(s) Silicon Graphics Developer(s) Khronos Group Stable release 4.2 …   Wikipedia

  • Java OpenGL — (JOGL) est une bibliothèque qui permet d utiliser OpenGL avec le langage de programmation Java[1],[2]. Elle était développée à l origine par Kenneth Bradley Russell et Christopher John Kline, et fut développée par la suite par le Sun Microsystems …   Wikipédia en Français

  • Java OpenGL — (JSR 231) Скриншот, демонстрирующий …   Википедия

  • Java Specification Request — Java Specification Requests Java Specification Requests (JSR) est un système normalisé ayant pour but de faire évoluer la plateforme Java. Sommaire 1 Présentation 2 Implémentation 3 Interopérabilité informatique …   Wikipédia en Français

  • Java Specification Requests — (JSR) est un système normalisé ayant pour but de faire évoluer la plateforme Java. Sommaire 1 Présentation 2 Implémentation 3 Liste des JSRs 4 Notes et …   Wikipédia en Français

  • Java OpenGL — Infobox Software name = JOGL (JSR 231) caption = A demo screenshot illustrating real time refraction using JOGL on Mac OS X developer = Sun Microsystems Game Technology Group latest release version = 1.1.1 latest release date = May 22, 2008… …   Wikipedia

  • Java Foundation Classes — Die Java Foundation Classes (JFC) ist eine Sammlung von Programmierschnittstellen (APIs) für die Erstellung portabler Java Graphical User Interfaces (GUIs). Die Java Foundation Classes werden durch die folgenden Features definiert: Swing GUI… …   Deutsch Wikipedia

  • Java Platform, Micro Edition — Java editions Java Card Micro Edition (ME) Standard Edition (SE) Enterprise Edition (EE) …   Wikipedia

  • OpenGL — Desarrollador Khronos Group www.opengl.org Información general Diseñador Silicon Graphics …   Wikipedia Español

  • OpenGL — Тип API Раз …   Википедия

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”