Posted by
Douglas Lyon on
Jan 01, 2018; 3:27pm
URL: https://forum.jogamp.org/Jogl-Jogamp-on-Java-9-tp4038012p4038475.html
As testing continues to demonstrate interesting outcomes, here is what we found, so far.
JOGLQuad is now deployed to web start at:
http://www.docjava.com/book/cgij/code/jnlp/joglquad.jnlpWe are targeting jdk9 and that is the output of the bytecode version.
It all works well on a mac (jdk9). Yipee!
It crashes on windows 7. Mega downer!
Considering that no java3d was involved, this is indicating a jogl issue.
Could be our build of the windows libs are to blame (this is likely). Probably just
a dumb bug that prevents our finding a good config...hmm.
Here are some details, below.
Thank you for your thoughts and efforts.
Regards,
- Doug
http://www.docjava.com/book/cgij/code/jnlp/joglquad.jnlpjava.lang.ArrayIndexOutOfBoundsException: -1
at jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationImpl(WindowsAWTWGLGraphicsConfigurationFactory.java:171)
at com.jogamp.nativewindow.GraphicsConfigurationFactory.chooseGraphicsConfiguration(GraphicsConfigurationFactory.java:424)
at com.jogamp.opengl.awt.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:1560)
at com.jogamp.opengl.awt.GLCanvas.addNotify(GLCanvas.java:611)
at java.desktop/java.awt.Container.addNotify(Unknown Source)
at java.desktop/java.awt.Window.addNotify(Unknown Source)
at java.desktop/java.awt.Frame.addNotify(Unknown Source)
at java.desktop/java.awt.Window.show(Unknown Source)
at java.desktop/java.awt.Component.show(Unknown Source)
at java.desktop/java.awt.Component.setVisible(Unknown Source)
at java.desktop/java.awt.Window.setVisible(Unknown Source)
at j3d.JOGLQuad.main(JOGLQuad.java:96)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at jdk.javaws@9.0.1/com.sun.javaws.Launcher.executeApplication(Unknown Source)
at jdk.javaws@9.0.1/com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at jdk.javaws@9.0.1/com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at jdk.javaws@9.0.1/com.sun.javaws.Launcher.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
package j3d;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.GL2ES1;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.awt.GLCanvas;
import com.jogamp.opengl.fixedfunc.GLLightingFunc;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.opengl.util.Animator;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/**
* Self-contained example (within a single class only to keep it simple)
* displaying a rotating quad
*/
public class JOGLQuad implements GLEventListener {
private float rotateT = 0.0f;
@Override
public void display(GLAutoDrawable gLDrawable) {
final GL2 gl = gLDrawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glClear(GL.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -5.0f);
// rotate about the three axes
gl.glRotatef(rotateT, 1.0f, 0.0f, 0.0f);
gl.glRotatef(rotateT, 0.0f, 1.0f, 0.0f);
gl.glRotatef(rotateT, 0.0f, 0.0f, 1.0f);
// Draw A Quad
gl.glBegin(GL2.GL_QUADS);
gl.glColor3f(0.0f, 1.0f, 1.0f); // set the color of the 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
// Done Drawing The Quad
gl.glEnd();
// increasing rotation for the next iteration
rotateT += 0.2f;
}
@Override
public void init(GLAutoDrawable glDrawable) {
GL2 gl = glDrawable.getGL().getGL2();
gl.glShadeModel(GLLightingFunc.GL_SMOOTH);
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClearDepth(1.0f);
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glDepthFunc(GL.GL_LEQUAL);
gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
}
@Override
public void reshape(GLAutoDrawable gLDrawable, int x, int y, int width, int height) {
GL2 gl = gLDrawable.getGL().getGL2();
final float aspect = (float) width / (float) height;
gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
gl.glLoadIdentity();
final float fh = 0.5f;
final float fw = fh * aspect;
gl.glFrustumf(-fw, fw, -fh, fh, 1.0f, 1000.0f);
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
gl.glLoadIdentity();
}
@Override
public void dispose(GLAutoDrawable gLDrawable) {
}
public static void main(String[] args) {
final GLCanvas canvas = new GLCanvas();
final Frame frame = new Frame("Jogl Quad drawing");
final Animator animator = new Animator(canvas);
canvas.addGLEventListener(new JOGLQuad());
frame.add(canvas);
frame.setSize(640, 480);
frame.setResizable(false);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
animator.stop();
frame.dispose();
System.exit(0);
}
});
frame.setVisible(true);
animator.start();
canvas.requestFocus();
}
}