Hello Javagaming-People,
i have some problem with Jogl on my new Ubuntu 8.04 machine. If i start the App (Jogl, JFrame, GLEventListener) the output ist for a half second the correct picture and then it disappears and only a grey window is visible. If i toggle between maximize and normal window, the output is for a very short time shown and disappears again. Under Windows the same sourcecode acts as expected.
Thanks for your help!
Cheers, Chris
import javax.media.opengl.*;
import javax.swing.JFrame;
public final class Main extends JFrame implements GLEventListener {
public Main() {
GLCanvas canvas = new GLCanvas();
canvas.setSize(640, 480);
canvas.addGLEventListener(this);
add(canvas);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setVisible(true);
}
@Override
public void init(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(-4d / 3d, 4d / 3d, -1d, 1d, 0d, 2d);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
}
@Override
public void display(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glRectf(-.8f, -.8f, .8f, .8f);
}
@Override
public void displayChanged(GLAutoDrawable drawable, boolean modeChanged,
boolean deviceChanged) {}
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width,
int height) {}
private static final long serialVersionUID = 0l;
/**
* Startet die Anwendung.
* @param args Nicht verwendet
*/
public static void main(String[] args) {
new Main();
}
}