Login  Register

Re: Unable to set pixel format 4 for device context

Posted by Sven Gothel on May 02, 2011; 9:32pm
URL: https://forum.jogamp.org/Unable-to-set-pixel-format-4-for-device-context-tp2852819p2891490.html

On Monday, May 02, 2011 04:54:01 pm RobC [via jogamp] wrote:

>
> I just discovered something that seems very interesting with this problem. I
> had thought the problem was when moving between two different frames
> displaying OpenGL 3D, but it actually looks like it may be a window thing. I
> ran the test program that you sent over and noticed that when I hovered the
> mouse over the Eclipse window behind the app, the app always broke. The area
> of Eclipse that caused the app to break on mouse over was the isolated to
> the package explorer. When I hovered over a package, a tooltip came up and
> the app broke (with the "Unable to set pixel format..."). I began testing
> this with other windows(Windows Explorer, Command Prompts) and it seems very
> consistent that almost every time another window becomes active, the 3D app
> breaks, and even when a window becomes active and DOESN'T break the app,
> making the 3D window active again DOES break it. I'm not sure if any of this
> will help at all, but it seems like something worth mentioning.

Hi Rob, hi Wade,

thank you for your bug report!

I just tested your test app from you bug report,
and it doesn't reproduce the bug on Win7 x64 w/ java 32bit (NV gpu).

Will try VBOX .. and Wade's code.

However, looking at your SimpleScene code, I already can tell that you
violate the AWT constraints, where you only shall modify a visible thing
on the AWT EDT.

http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLCanvasRecreate01.java;h=2faf8fa667000b9602dac30f4061c6925eec6ced;hb=HEAD#l113
        try {
            javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
                public void run() {
                    glCanvas.destroy();
                    frame1.dispose();
                    frame2.dispose();
                }});
        } catch (Throwable t) {
            t.printStackTrace();
            Assume.assumeNoException(t);
        }

The issue might be a simple AWT race condition, where the added Canvas's PFD is already set
before we get a chance .. IE those errors about not able to set the GDI PFD of the onscreen surface
usually means it's already set, or it is an offscreen one.

Pls try the AWT EDT as described above, thx.

~Sven

>
> Thanks,
> Rob