about the JOGL 2 problem

Posted by Chuchinyi on Game Development See other posts from Game Development or by Chuchinyi
Published on 2011-11-21T08:06:16Z Indexed on 2011/11/21 10:22 UTC
Read the original article Hit count: 501

Filed under:
|
|
|
|

Please some help me about the JOGL 2 problem(Sorry for previous error format).
I complied JOGL2Template.java ok.
but execut it with following error.

D:\java\java\jogl>javac JOGL2Template.java        <== compile ok      
D:\java\java\jogl>java JOGL2Template               <== execute error      
Exception in thread "main" java.lang.ExceptionInInitializerError        
        at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:1176)        
        at JOGL2Template.<init>(JOGL2Template.java:24)        
        at JOGL2Template.main(JOGL2Template.java:57)        
Caused by: java.lang.SecurityException: no certificate for gluegen-rt.dll in D:\
java\lib\gluegen-rt-natives-windows-i586.jar        
        at com.jogamp.common.util.JarUtil.validateCertificate(JarUtil.java:350)        
        at com.jogamp.common.util.JarUtil.validateCertificates(JarUtil.java:324)

        at com.jogamp.common.util.cache.TempJarCache.validateCertificates(TempJa
rCache.java:328)        
        at com.jogamp.common.util.cache.TempJarCache.bootstrapNativeLib(TempJarC
ache.java:283)        
        at com.jogamp.common.os.Platform$3.run(Platform.java:308)        
        at java.security.AccessController.doPrivileged(Native Method)        
        at com.jogamp.common.os.Platform.loadGlueGenRTImpl(Platform.java:298)        
        at com.jogamp.common.os.Platform.<clinit>(Platform.java:207)        
        ... 3 more        

there is JOGL2Template.java source code:

import java.awt.Dimension;        
import java.awt.Frame;        
import java.awt.event.WindowAdapter;        
import java.awt.event.WindowEvent;        
import javax.media.opengl.GLAutoDrawable;        
import javax.media.opengl.GLCapabilities;        
import javax.media.opengl.GLEventListener;        
import javax.media.opengl.GLProfile;        
import javax.media.opengl.awt.GLCanvas;        
import com.jogamp.opengl.util.FPSAnimator;        
import javax.swing.JFrame;        
/*        
 * JOGL 2.0 Program Template For AWT applications        
 */        
public class JOGL2Template extends JFrame implements GLEventListener {        
   private static final int CANVAS_WIDTH = 640;  // Width of the drawable        
   private static final int CANVAS_HEIGHT = 480; // Height of the drawable        
   private static final int FPS = 60;   // Animator's target frames per second        

   // Constructor to create profile, caps, drawable, animator, and initialize Frame        
   public JOGL2Template() {        
      // Get the default OpenGL profile that best reflect your running platform.        
      GLProfile glp = GLProfile.getDefault();        
      // Specifies a set of OpenGL capabilities, based on your profile.        
      GLCapabilities caps = new GLCapabilities(glp);        
      // Allocate a GLDrawable, based on your OpenGL capabilities.        
      GLCanvas canvas = new GLCanvas(caps);        
      canvas.setPreferredSize(new Dimension(CANVAS_WIDTH, CANVAS_HEIGHT));        
      canvas.addGLEventListener(this);        

      // Create a animator that drives canvas' display() at 60 fps.        
      final FPSAnimator animator = new FPSAnimator(canvas, FPS);        

      addWindowListener(new WindowAdapter() {     // For the close button        
         @Override        
         public void windowClosing(WindowEvent e) {        
            // Use a dedicate thread to run the stop() to ensure that the        
            // animator stops before program exits.        
            new Thread() {        
               @Override        
               public void run() {        
                  animator.stop();        
                  System.exit(0);        
               }        
            }.start();        
         }        
      });        
      add(canvas);        
      pack();        
      setTitle("OpenGL 2 Test");        
      setVisible(true);        
      animator.start();   // Start the animator        
   }        
   public static void main(String[] args) {        
      new JOGL2Template();        
   }        
   @Override        
   public void init(GLAutoDrawable drawable) {        
      // Your OpenGL codes to perform one-time initialization tasks        
      // such as setting up of lights and display lists.        
   }               
   @Override        
   public void display(GLAutoDrawable drawable) {        
      // Your OpenGL graphic rendering codes for each refresh.        
   }        
   @Override        
   public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {        
      // Your OpenGL codes to set up the view port, projection mode and view volume.        
   }        
   @Override        
   public void dispose(GLAutoDrawable drawable) {        
      // Hardly used.        
   }        
}        

© Game Development or respective owner

Related posts about opengl

Related posts about 3d