简体   繁体   中英

Netbeans and JOGL, problem with the GLCanvas

When I'm running the JOGL Application(Form Designer, GLCanvas) in the Netbeans 6.7.1 the GLCanvas disappear after less than one second (then I can see only jframe without GLCanvas component). Next when I'm maximizing the window, the GLCanvas reappear for a moment and disappear too. The JOGL Application(Form Designer, GLPanel) works properly after running. Where is the problem ?

I'm using a newer version of Netbeans so I cant use the JOGL plugin.. But, Ive encountered the problem you are describing.. For me it seemed like it was only drawing the first frame and then it stopped. I'm not sure but i think GLCanvas need a FPSAnimator.. And as far as I know the JOGL template in the plugin didn't create one..(or?) It did the trick for me

example:

    Frame frame = new Frame("test");
    GLCanvas canvas;
    FPSAnimator animator;
    GLCapabilities caps = new GLCapabilities();
    caps.setDoubleBuffered(true);
    caps.setHardwareAccelerated(true);
    canvas = new GLCanvas(caps);
    animator = new FPSAnimator(canvas, 60);
    canvas.addGLEventListener(new Renderer());
    frame.add(canvas);
    frame.setSize(600, 600);
    animator.start();

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM