Java Bindings for OpenGL: Difference between revisions

Content deleted Content added
ZoFreX (talk | contribs)
Example: same again
m Various minor fixups
Line 7:
 
==Example==
This examples shows how to draw a Polygonpolygon (without initialization or repaint code) <ref>Borrowed from the [http://nehe.gamedev.net/lesson.asp?index=01 Nehe tutorial], whichwhose code areis free to use elsewhere.</ref>. Here is the reference [[C (programming language)|C]] implementation :
<source lang="c">
int DrawGLScene(GLvoid) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Line 27 ⟶ 28:
return TRUE;
}
</source>
 
Which translates to the following [[Java (programming language)|Java]] implementation :
<source lang="java">
public void display([http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GLAutoDrawable.html GLAutoDrawable] gLDrawable) {
public void display(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()];
final GL gl = gLDrawable.getGL();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
Line 48 ⟶ 51:
gl.glFlush();
}
</source>
 
== Implementations ==
Line 53 ⟶ 57:
 
== References ==
<Referencesreferences/>
 
== See also ==