JOGL 1.1.1a and multiple monitors

Hello,

I’m facing a problem with multi-monitor support and JOGL v1.1.1a: I’m using JOGL to draw some maps inside a Swing JFrame using the GLJPanel component. The logic I’m using works perfectly on a single-monitor setup and also on the primary screen of a multi-monitor setup, however as soon as I move the window to the secondary monitor the problems start appearing. On the second monitor I apparently do not get any callbacks in my GLEventListener class, and as such the OpenGL window turns ‘gray’ (nothing is drawn on top of it). If I move the window to the primary monitor again, the GLJPanel remains gray. As soon as I resize the window again, the data is drawn again on the primary window.

It looks to me a problem of the GLJPanel not properly being ‘triggered’ for the second monitor.

What I’ve tried / discovered so far:

  • the problem does not occur with GLCanvas, this one works perfectly.
  • no exceptions are thrown by JOGL.
  • using a debugger I’ve found out that my own implementation of the Animator (loosly based on FPSAnimator and extending from Animator) still gets the proper triggers the ‘display’ method of the superclass (Animator).
  • the problem is not hardware/configuration related, I managed to reproduce it on any system I have, although always on Windows (32 bit or 64 bit).

Any suggestions on what I should try further to get GLJPanel properly working on a secondary monitor in a multi-monitor setup?

Thanks,
Kenny

I am having somehow the same problem but in different context. I have Jide layout and the scene is in the center docked if you undock the scene will show and if you dock it will turn grey.

Note: only seen on java 6 update 14 and above. i reverted to U13 and it worked fine.

Maybe it will help in your case as well

I added a new topic for the above stated problem with java6U14

http://www.java-gaming.org/index.php/topic,21296.0.html

I’ve digged this out a little bit further and came to the conclusion that in case of GLJPanel this is somehow blocked very deep inside the code of Java2D/JVM, basically it is blocked in this piece of code (part of Win32GraphicsDevice):


            // first try to create a WGLGraphicsConfig if OGL is enabled
            // REMIND: the WGL code does not yet work properly in multimon
            // situations, so we will fallback on GDI if we are not on the
            // default device...
            if (WindowsFlags.isOGLEnabled() && isDefaultDevice()) {
                int defPixID = WGLGraphicsConfig.getDefaultPixFmt(screen);
                defaultConfig = WGLGraphicsConfig.getConfig(this, defPixID);
                if (WindowsFlags.isOGLVerbose()) {
                    if (defaultConfig != null) {
                        System.out.print("OpenGL pipeline enabled");
                    } else {
                        System.out.print("Could not enable OpenGL pipeline");
                    }
                    System.out.println(" for default config on screen " +
                                       screen);
                }
            }

In this case the isDefaultDevice() call returns false and as such the wrong ‘Surface’ will be used which is later on OGLUtilities class:


                SurfaceData sData = ((SunGraphics2D)g).surfaceData;
                if (!(sData instanceof OGLSurfaceData)) {
                    return false;
                }

This check will fail and as such the call won’t be made to draw the OpenGL…

Any ideas why GLCanvas works properly?
Any workarounds for this issue?

Kind regards,

[quote]GLJPanel this is somehow blocked very deep inside the code of Java2D/JVM
[/quote]
The reasoneable answer is because the canvas is somehow a heavyweight-component and got its peer created on the current device. e.g. create a canvas with an explicit graphics configuration. Panel might be linked to a peer (understand “laid out by the Window”) that’s not on the current screen device and that puts it in trouble.