你如何完全关闭JOGL / NEWT GLWindow?

时间:2015-03-08 19:08:27

标签: jogl nativewindow

我有一个令人难以置信的愚蠢的小样本,可能直接从教程中撕开,每次运行它都会在退出时生成警告。我很好奇我错过了什么。任何想法,链接,我忘记的事情?

这是主窗口设置...

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]

1 个答案:

答案 0 :(得分:2)