Login  Register

Re: Possible to have GLCanvas's display() called *after* all other Swing events?

Posted by farrellf on Nov 09, 2017; 6:04pm
URL: https://forum.jogamp.org/Possible-to-have-GLCanvas-s-display-called-after-all-other-Swing-events-tp4038306p4038310.html

Yes, I use an Animator. My code looks like this:

        glCanvas = new GLCanvas(new GLCapabilities(GLProfile.get(GLProfile.GL2)));
        glCanvas.addGLEventListener(new GLEventListener() { ... }
       
        setLayout(new BorderLayout());
        add(glCanvas, BorderLayout.CENTER);

        animator = new Animator(glCanvas);
        animator.setUpdateFPSFrames(1, null);
        animator.start();

Thanks for the tip about mouse position. But that still leaves the more visually annoying problem when the glCanvas is resized. It looks like reshape() is called one frame after the enclosing component size changes. There is a very noticeable stutter if I resize the JFrame, or if I resize one of the JPanels in my BorderLayout (which therefore causes the glCanvas to be resized.) Any ideas?

-Farrell