jogl release in sep 14

im talking about the latest release of jogl… there is not enough examples and it seems that the older examples dont work on this api…

where can i get examples starting from simple window , to drawing lines and then cube and progress…

peace

ok … i was looking and found this … hope it can help others…

/*

  • Example 2: Hello JOGL
  • Draws a multi-colored triangle to the GLCanvas. As in the previous
  • example, the GLCanvas is placed in a JFrame and made visible. This
  • time OpenGL functions are called in the init, reshape and display
  • methods to set up the OpenGL environment and draw the triangle.
  • OpenGL commands can only be executed within the GLEventListener
  • methods (when called automatically). The OpenGL context is not
  • current anywhere else, and OpenGL calls will have no effect.
  • It is recommended to always retrieve the GL object from the
  • GLDrawable parameter in the GLEventListener methods as opposed to
  • storing the object in a instance variable. The reason for this is
  • that if it is stored in an instance variable, it is too easy to
  • use it to call OpenGL methods in places other than the GLEventListener
  • methods.
  • Author: David Wolff
  • Licensed under the Creative Commons Attribution License 2.5:
  • http://creativecommons.org/licenses/by/2.5/
    */

//package tutorial.b_HelloJOGL;

import java.awt.BorderLayout;

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLEventListener;
import javax.swing.JFrame;

public class HelloJOGL implements GLEventListener {

/* 
 * Set up the background color, and clear the modelview matrix.
 */
public void init( GLAutoDrawable d ) { 
	GL gl = d.getGL();
	gl.glClearColor( 0,0,0,0 );
	gl.glMatrixMode( GL.GL_MODELVIEW );
	gl.glLoadIdentity();
}

/* 
 * Set up a simple orthographic projection, with a square
 * window.
 */
public void reshape( GLAutoDrawable d, int x, int y, int width, int height ) { 
	GL gl = d.getGL();
	gl.glMatrixMode( GL.GL_PROJECTION );
	gl.glLoadIdentity();
	gl.glOrtho( -1.0, 1.0, -1.0, 1.0, -0.1, 0.1 );
	gl.glMatrixMode( GL.GL_MODELVIEW );
}

/* 
 * Draw a triangle.
 */
public void display( GLAutoDrawable d ) { 
	GL gl = d.getGL();
	gl.glClear(GL.GL_COLOR_BUFFER_BIT);
	gl.glBegin( GL.GL_TRIANGLES );
		gl.glColor3f(1.0f,0.0f,0.0f);
		gl.glVertex2d( -0.75, -0.75 );
		gl.glColor3f(0.0f,0.0f,1.0f);
		gl.glVertex2d( 0.75, -0.75 );
		gl.glColor3f(0.0f,1.0f,0.0f);
		gl.glVertex2d( 0.0, 0.75 );
	gl.glEnd();
}

/*
 * Create a JFrame containing a GLCanvas.  The GLEventListener
 * for the GLCanvas is an instance of HelloJOGL.
 */
public static void main( String[] args ) {
	JFrame frame = new JFrame();
	frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
	
	// Create a GLCanvas object and place into the JFrame
	GLCanvas canvas = new GLCanvas();
	canvas.setSize(400,400);
	
	// Add an instance of HelloJOGL as the GLEventListener for
	// the GLCanvas.
	canvas.addGLEventListener( new HelloJOGL() );
	
	frame.getContentPane().add( canvas, BorderLayout.CENTER );
	
	frame.pack();
	frame.setVisible( true );
}

/*
 * Unused method.
 */
public void displayChanged( GLAutoDrawable d, boolean modeChanged, 
	boolean deviceChanged ) { }

}

The Red Book examples ported to JOGL, which are linked from the JOGL Demos page, should provide many examples along these lines. The NeHe demos which are linked from the same page also provide good tutorials. There are more links in the “Useful Links” box on the jogl-demos home page.

does any one notice that when doing 3D animation and placing the canvas in JFrame, we end up with flickering when ever the frame is moved?? i mean bad flickering …

peace

Are you running on Windows? If so, are you specifying -Dsun.java2d.noddraw=true (check the JOGL User’s Guide)?