Login  Register

Re: Jogl Using Wrong (Generic) Graphics Adapter

Posted by Tobi Delbruck on Nov 27, 2014; 3:09pm
URL: https://forum.jogamp.org/Jogl-Using-Wrong-Generic-Graphics-Adapter-tp4033216p4033655.html

We are having what could be a related problem. It could be that we are doing something wrong.

We have a Swing-based application that sometimes has this problem of dropping back to 1.1 software rendering (is this GDI?).

The problem occurs when more than one GLCanvas is created, which runs in a different thread and possibly different OpenGL context. I am not too clear on OpenGL contexts, profiles, capabilities etc so we could easily be doing something wrong. But this is a problem that did not occur in the past and only started after we went to JOGL 2.x; it did not occur when we were using JOGL 1.1.1.

In our headless main method, we now create a dummy window and then in each slave we assign this shared context to the new GLCanvas. But still, after a random number of new windows are opened (which is machine dependent) we get the exception occurring.

Here are some details:

Test machine: Windows 7x64 SP1, Nvidia GeForce GT630,  Driver 344.75, 64-bit JDK 8.01, JOGL 2.2.4

Our headless, no graphics main method:

    public static GLAutoDrawable sharedDrawable; // This is JAERViewer.sharedDrawable

    final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()) ;
    final GLProfile glp = caps.getGLProfile();
    final boolean createNewDevice = true; // use 'own' display device!
    sharedDrawable = GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null, createNewDevice, caps, null);
    sharedDrawable.display(); // triggers GLContext object creation and native realization. sharedDrawable is a static variable that can be used by all AEViewers and file preview dialogs

Slave method constructor:

    List<GLCapabilitiesImmutable> capsAvailable=GLDrawableFactory.getDesktopFactory().getAvailableCapabilities(null);
    GLCapabilitiesImmutable chosenGLCaps=null;
    int listnum=0;
    for(GLCapabilitiesImmutable cap:capsAvailable){
        log.info("GLCapabilitiesImmutable #"+listnum+" is "+cap.toString());
        if(chosenGLCaps==null) chosenGLCaps=cap;
        if(listnum++>=0) break;
    }
    drawable = new GLCanvas(chosenGLCaps);
   drawable.setSharedAutoDrawable(JAERViewer.sharedDrawable); // TODO tobi added to try to use shared context between all viewers and file open dialog previews.
 
No exception on construction is ever thrown. But on first instantiation of slave window display() method, we sometimes, on some machines, get this uncaught exception:

    WARNING: AWT-EventQueue-0
    javax.media.opengl.GLException: AWT-EventQueue-0: WindowsWGLContex.createContextImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.0.1). Requested: GLProfile[GL4bc/GL4bc.hw], current: 1.1 (Compat profile, hardware) - 1.1.0
        at jogamp.opengl.windows.wgl.WindowsWGLContext.createImpl(WindowsWGLContext.java:371)
        at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:694)
        at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:589)
        at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:539)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1263)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1131)
        at javax.media.opengl.awt.GLCanvas$11.run(GLCanvas.java:1394)
        at javax.media.opengl.Threading.invoke(Threading.java:223)
        at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:525)
        at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:579)
        at sun.awt.RepaintArea.paintComponent(RepaintArea.java:264)
        at sun.awt.RepaintArea.paint(RepaintArea.java:240)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:347)
        at java.awt.Component.dispatchEventImpl(Component.java:4959)
        at java.awt.Component.dispatchEvent(Component.java:4705)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)
        at java.awt.EventQueue.access$400(EventQueue.java:97)
        at java.awt.EventQueue$3.run(EventQueue.java:697)
        at java.awt.EventQueue$3.run(EventQueue.java:691)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
        at java.awt.EventQueue$4.run(EventQueue.java:719)
        at java.awt.EventQueue$4.run(EventQueue.java:717)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)


After this it is not possible to create any new GLCanvas without this exception being thrown.

Any suggestions would be appreciated.
Many thanks.
Tobi