如何在init上最大化JOGL GLWindow

时间:2015-04-24 18:13:13

标签: java opengl jogl

我想要的是在所有操作系统上最大化的GLWindow。因此,window.setSize(300, 300);行应替换为window.setSize(GLWindow.MAXIMIZED);之类的内容。我已经找了很久了,但我找不到应该怎么做。提前谢谢。

主:

public static void main(String[] args) {

    GLProfile glp = GLProfile.getDefault();
    GLCapabilities caps = new GLCapabilities(glp);

    WindowFactory windowFactory = new WindowFactory();
    GLWindow window = windowFactory.getWindow(caps);

    window.addGLEventListener(new Main());

    FPSAnimator animator = new FPSAnimator(window, 30);
    animator.start();

}

窗口:

public GLWindow getWindow(GLCapabilities caps) {

    GLWindow window = GLWindow.create(caps);

    window.setSize(300, 300);
    window.setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE);
    window.setVisible(true);

    return window;

}

1 个答案:

答案 0 :(得分:0)

public GLWindow getWindow(GLCapabilities caps) {

GLWindow window = GLWindow.create(caps);

Screen screen = window.getScreen();
window.setSize(screen.getWidth, screen.getHeight);

window.setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE);
window.setVisible(true);

return window;

}