I posted here because I have read this in official JOGL Userguide: [quote]The JOGL forum on javagaming.org is the best place to ask questions about the library. Many users, as well as the Jogl developers, read this forum frequently, and the archived threads contain a lot of useful information (which still needs to be distilled into documentation).
[/quote]
Yes, I would appreciate on more complete example, but first I’ll be more concrete with my problem. Maybe you’'ll figure out what I did wrong.
public class MainFrame extends JFrame implements ActionListener {
JButton jb_refresh = new JButton("Refresh");
OpenGLCanvas openGLCanvas;
...
public MainFrame() {
openGLCanvas = new OpenGLCanvas(this);
...
jb_refresh.addActionListener(this);
getContentPane().add(jb_refresh, BorderLayout.NORTH);
getContentPane().add(openGLCanvas.getGlCanvas(), BorderLayout.CENTER);
}
...
public void actionPerformed(ActionEvent e) {
// some calcs to set new values in
...
openGLCanvas.getGl_canvas().display();
openGLCanvas.getGl_canvas().requestFocusInWindow();
}
...
// main method etc.
}
public class OpenGLCanvas implements GLEventListener, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener {
MainFrame frame;
GLCanvas glCanvas;
public OpenGLCanvas(MainFrame frame) {
this.frame = frame;
initContent();
}
private void initContent() {
GLProfile glprofile = GLProfile.getDefault();
GLCapabilities glcapabilities = new GLCapabilities(glprofile);
glCanvas = new GLCanvas(glcapabilities);
glCanvas.addGLEventListener(this);
glCanvas.addKeyListener(this);
glCanvas.addMouseListener(this);
glCanvas.addMouseMotionListener(this);
glCanvas.addMouseWheelListener(this);
}
public GLCanvas getGlCanvas() {
return glCanvas;
}
public void init(GLAutoDrawable glAutoDrawable) {
...
}
public void display(GLAutoDrawable glAutoDrawable) {
...
}
public void dispose(GLAutoDrawable glAutoDrawable) {
...
}
public void reshape(GLAutoDrawable glAutoDrawable, int x, int y, int width, int height) {
...
}
...
}