MacOSX exception: BackingLayerHost w/ unknown handle

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

MacOSX exception: BackingLayerHost w/ unknown handle

standev
Hello people.

I am attempting to implement OpenGL based on some reference material. After adding all the necessary code,
I attempted to a run an unit test (the code of this can be found here: https://pastebin.com/B5sKmU20.)
However, I get an error at line 81 " int res = glContext.makeCurrent();", the full error is disclosed below.
Can someone help me resolve this, I couldn't find any other threads of people experiencing similar issues.

Thanks in advance :)

Java version:
1.8.0_131 (1.8.0 update 131)
MacOSX version:
10.12.6 (macOS Sierra)


com.jogamp.opengl.GLException: BackingLayerHost w/ unknown handle (!FBO, !PBuffer): MacOSXOnscreenCGLDrawable[Realized true,
        Factory   jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory@6d4e5011,
        Handle    0x7fac1d0f8040,
        Surface   JAWTWindow[0x7e5afaa6][JVM version: 1.8.0_131 (1.8.0 update 131)
JAWT version: 0x80010004, CA_LAYER: true, isLayeredSurface true, bounds [ 0 / 0  100 x 78 ], insets [ l 0, r 0 - t 0, b 0 - 0x0], pixelScale 1.0x1.0, shallUseOffscreenLayer false, isOffscreenLayerSurface true, attachedSurfaceLayer 0x0, windowHandle 0x7fac23914e30, surfaceHandle 0x7fac1d0f8040, bounds [ 0 / 0  100 x 78 ], insets [ l 0, r 0 - t 0, b 0 - 0x0], window [0/0 100x78], pixels[scale 1.0, 1.0 -> 100x78], visible true, lockedExt false,
        config AWTGraphicsConfiguration[AWTGraphicsScreen[AWTGraphicsDevice[type .awt, connection Display 69510216, unitID 0, awtDevice sun.awt.CGraphicsDevice@63a12c68, handle 0x0], idx 1],
        chosen    GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL2/GL2.hw], offscr[auto-cfg]],
        requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL2/GL2.hw], on-scr[.]],
        CGLGraphicsConfig[dev=69510216,pixfmt=0],
        encapsulated MacOSXCGLGraphicsConfiguration[DefaultGraphicsScreen[MacOSXGraphicsDevice[type .macosx, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x28f3b248]], idx 1],
        chosen    GLCaps[rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL2/GL2.hw], on-scr[.]],
        requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL2/GL2.hw], on-scr[.]]]],
        awtComponent java.awt.Canvas[canvas0,0,0,100x78],
        surfaceLock <1b1426f4, 32b260fa>[count 1, qsz 0, owner <main>]]]

        at jogamp.opengl.macosx.cgl.MacOSXCGLContext$NSOpenGLImpl.associateDrawable(MacOSXCGLContext.java:877)
        at jogamp.opengl.macosx.cgl.MacOSXCGLContext.associateDrawable(MacOSXCGLContext.java:400)
        at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:712)
        at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:586)
        at org.empyrean.client.graphics.opengl.ShaderTest.before(ShaderTest.java:81)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
        at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
        at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
        at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
 
Reply | Threaded
Open this post in threaded view
|

Re: MacOSX exception: BackingLayerHost w/ unknown handle

gouessej
Administrator
Hello

Do you reproduce this bug with our unit tests?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: MacOSX exception: BackingLayerHost w/ unknown handle

uhok
I'm new to JOGL, and I am also experiencing a similar issue.

I am trying to port an existing JOGL application that currently runs on windows + linux to mac, and when I call `makeCurrent()` I get the same error. The error goes away if I call `isFBO(true)` in the associated GLCapabilities, but when I do this `offscreen` is also set to true, resulting in no visible content being drawn.

The default GLCapabilities I receive from the following has isFBO, isPBuffer, and isBitmap all false by default, and onscreen true.

GLProfile glProfile = GLProfile.get(GLProfile.GL4);
GLCapabilities glCaps = new GLCapabilities(glProfile);

I am not sure why it is that this code works on windows + linux but not on mac. Any guidance would be appreciated, and I would be glad to provide any additional necessary information.

Reply | Threaded
Open this post in threaded view
|

Re: MacOSX exception: BackingLayerHost w/ unknown handle

uhok
One thing, I am using macOS 10.14.3
Reply | Threaded
Open this post in threaded view
|

Re: MacOSX exception: BackingLayerHost w/ unknown handle

uhok
I've found this thread ( http://forum.jogamp.org/Issue-with-Java-3D-under-OpenJDK-7-Mac-OS-X-td4025259i20.html
 ), though I'm having a hard time figuring out what exactly the solution that was arrived at was.

It seems my project is using java.awt.canvas and not a custom canvas like Canvas3D


Below is how my drawable is created (trimming a bit of code out from above)

                                GLProfile glProfile = GLProfile.get(GLProfile.GL4);


                                GLCapabilities glCaps = new GLCapabilities(glProfile);
                                // This line is necessary to avoid a crash on mac
                                if (OSType.getOSType() == OSType.MacOS)
                                {
// glCaps.setFBO(true);
                                }


                                AWTGraphicsConfiguration config = AWTGraphicsConfiguration.create(canvas.getGraphicsConfiguration(), glCaps, glCaps);

                                jawtWindow = NewtFactoryAWT.getNativeWindow(canvas, config);
                                canvas.setFocusable(true);

                                GLDrawableFactory glDrawableFactory = GLDrawableFactory.getFactory(glProfile);

                                glDrawable = glDrawableFactory.createGLDrawable(jawtWindow);
                                glDrawable.setRealized(true);
                                glContext = glDrawable.createContext(null);
                                int res = glContext.makeCurrent();
Reply | Threaded
Open this post in threaded view
|

Re: MacOSX exception: BackingLayerHost w/ unknown handle

gouessej
Administrator
Have you tried to call setOnscreen(true) too?

By the way, use a recent version of Java3D >= 1.6 and do the same with OpenJDK, use at least OpenJDK 1.8 under OS X.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: MacOSX exception: BackingLayerHost w/ unknown handle

uhok
This post was updated on .
How would I check my Java3D version? I searched through the project and did not see the exact phrase "Java3D" anywhere.

From terminal, javac -version outputs "javac 10.0.1", so I believe that I am using JDK 10. Would switching to OpenJDK make a difference? I could also try updating to version 11, as it seems that support for JDK 10 has ended.

I added the setOnscreen(true) call as follows, and the crash still happens. I can confirm that this particular line does run, but I don't believe it has an impact as the debugger shows that within glCaps, onscreen is set to True before this line executes.

When I call setFBO followed by setOnscreen, the application crashes. The application also crashes, with the original error, if I call only setOnscreen.

if (OSType.getOSType() == OSType.MacOS)
                                {
                                        glCaps.setOnscreen(true);
                                }


Reply | Threaded
Open this post in threaded view
|

Re: MacOSX exception: BackingLayerHost w/ unknown handle

uhok
I set Intellij to build with JDK 1.8.0_71, which I had a copy of, and this crash still occurs.

I also installed a copy of JDK 11, and set intellij to use that, but the crash remains.

I can provide the full content of the error message if that would help, or provide any other helpful information.
Reply | Threaded
Open this post in threaded view
|

Re: MacOSX exception: BackingLayerHost w/ unknown handle

gouessej
Administrator
In reply to this post by uhok
Where did you get Java3D?

http://jogamp.org/deployment/java3d/ ?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: MacOSX exception: BackingLayerHost w/ unknown handle

uhok
This post was updated on .
To my knowledge I've never directly installed Java3D. I've installed JDKs from Oracle's site, but unless those came bundled with Java3D, or unless Java3D was installed automatically by some project, I don't believe I've installed it.

I spoke with the individual that wrote the JOGL code that I am trying to port, but he is not familiar with Java3D, and believes the only way we would be using it is if something we are relying on uses it internally.

If it matters, I was able to download and run the gears demo from the JOGL site.
Reply | Threaded
Open this post in threaded view
|

Re: MacOSX exception: BackingLayerHost w/ unknown handle

gouessej
Administrator
Sorry but we only maintain JogAmp's Java3D, not old Oracle versions:
http://forum.jogamp.org/JogAmp-s-Java3D-continuation-Java3D-1-6-0-and-later-td4030907.html
Julien Gouesse | Personal blog | Website