>我有一个非常愚蠢的小样本,可能是直接从教程中撕下来的,每次运行时都会在退出时生成警告。我很好奇我错过了什么。有什么想法、链接、我忘记的东西吗?
这是主窗口设置...
package com.emarcotte;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.FPSAnimator;
public class Main2 {
public static void main(String[] args) {
final RenderLoop loop = new RenderLoop();
GLProfile glp = GLProfile.get(new String[] { GLProfile.GL3 }, true);
GLCapabilities caps = new GLCapabilities(glp);
GLWindow window = GLWindow.create(caps);
window.setSize(300, 300);
window.setVisible(true);
window.setTitle("NEWT Window Test");
window.addGLEventListener(loop);
window.setAnimator(new FPSAnimator(window, 120));
window.getAnimator().start();
window.addWindowListener(new WindowAdapter() {
@Override public void windowResized(WindowEvent we) {
loop.setHeight(window.getHeight());
loop.setWidth(window.getWidth());
}
});
window.addKeyListener(new KeyAdapter() {
@Override public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
window.getAnimator().stop();
}
}
});
}
}
以下是警告:
X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 2/2, reusable (open, marked uncloseable): 0, pending (open in creation order): 2)
X11Util: Open X11 Display Connections: 2
X11Util: Open[0]: NamedX11Display[:0.0, 0x7f214c0012b0, refCount 1, unCloseable false]
X11Util: Open[1]: NamedX11Display[:0.0, 0x7f214c017390, refCount 1, unCloseable false]
调用 GLWindow.destroy() 关闭您的 NEWT GLWindow: http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/opengl/GLWindow.html#destroy%28%29