I have this simple first program which runs correctly.
public class OpenGL extends JFrame implements GLEventListener {
GLCanvas glCanvas;
public OpenGL() {
setTitle("First OpenGL Program");
setSize(600, 600);
setLocation(0, 0);
glCanvas = new GLCanvas();
glCanvas.addGLEventListener(this);
this.add(glCanvas);
setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main (String[] args) {
new OpenGL();
}
}
But I'm not sure what the following lines of code do:
glCanvas.addGLEventListener(this);
this.add(glCanvas);
我在这里找到了对我的问题的很好的解释
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.