Login  Register

Re: Jogl Using Wrong (Generic) Graphics Adapter

Posted by Tobi Delbruck on Dec 22, 2014; 11:58am
URL: https://forum.jogamp.org/Jogl-Using-Wrong-Generic-Graphics-Adapter-tp4033216p4033803.html

Finally some progress, not in making a JUnit test case but in solving the problem.

First, the problem of dropping back to software rendering was solved by replacing the call to retrieve the screen insets by the following:

       Dimension sd = Toolkit.getDefaultToolkit().getScreenSize();

        // determine the height of the windows taskbar by this roundabout proceedure
        // TODO tobi removed this because it was causing a runtime native code exception using NVIDIA 181.22 driver with win xp
        // replaced by hardcoded lowerInset
        lowerInset = 64;

        Rectangle windowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
        if (windowBounds != null) {
            lowerInset = sd.height - windowBounds.height;
        }


Secondly, I finally realized that I was doing what should not be done but is hard to catch: Running Swing/AWT code outside the Swing thread. I replaced the WindowSaver code that actually resizes the window with a call to Swing.invokeLater():

       final boolean resize2 = resize;
        final int w2=w, h2=h, x2=x, y2=y;
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                frame.setLocation(x2, y2);
                if (resize2 && !(frame instanceof DontResize)) {
                    frame.setSize(new Dimension(w2, h2));
                }
//        log.info("loaded settings location for "+frame.getName());
                framemap.put(name, frame);
                frame.validate();
            }
        });

Now I don't have the problems anymore. However the root of the original problem, which was caused by the call to
//                GraphicsConfiguration[] gc = gd.getConfigurations();
remains mysterious.

I'll see how this works on various machines and report back if anything new comes up.
Tobi