opengl-window problems

hi,

i’m totally new to jogl and i already got a problem at startup - i just want to render a small 512x384 window containing nothing but a white background. here’s my code:

import net.java.games.jogl.;
import java.awt.
;
import java.awt.event.*;

class main {
public static void main(String[] args) {
Frame frame = new Frame(“myprog”);
GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
frame.add(canvas);
frame.setSize(512, 384);
frame.setBackground(Color.WHITE);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.show();
}
}

…and here’s what i get:

i already tried this on a friend’s machine with a similar result - though it didn’t show up exactly the same…eh…random colors, it also did some quite crappy things like this. both of us even re-installed the latest ati graphics drivers…without success.

anyone got an idea of what could be wrong with this?

thx,
ceph

you have to add a GLEventListener which is the interface responsible for displaying the GLCanvas contents.

Right now, you’re looking at a portion of you computer’s RAM.

Lilian

thx i think that will help us

Hi, you must clean the window… but you must do it whit OpenGL code, in the GLEventListener. If you clean the window with awt code you won´t do nothing in the opengl canvas.

(My english is not good. I hope you understand