NEWT previously working on OS X, now fail :(

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

NEWT previously working on OS X, now fail :(

Christian Catchpole
I'v returned to my OS X code after an absence to find its "stopped working".  Iv upgraded to the latest version of JOGL - a good idea anyway, but I'm getting the same error.  I'v tried to eliminate environmental issues before posting.  I think something weird with OS X is going on as it was working fine several months ago.

My NEWT setup code is pretty standard (it was based on an example).

http://code.google.com/p/kumi/source/browse/trunk/src/java/net/catchpole/view/scene/Scene.java

The key here is i'm getting a detected screen size of 0x0....

User screen size 0x0
Detected screen size 0x0
Sun Sep  5 11:40:16 Catchpole.local java[808] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
2010-09-05 11:40:16.604 java[808:1303] An uncaught exception was raised
2010-09-05 11:40:16.605 java[808:1303] Error (1002) creating CGSWindow
2010-09-05 11:40:16.606 java[808:1303] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow'
*** Call stack at first throw:
(
        0   CoreFoundation                      0x00007fff884d4cc4 __exceptionPreprocess + 180
        1   libobjc.A.dylib                     0x00007fff85cf10f3 objc_exception_throw + 45
        2   CoreFoundation                      0x00007fff884d4ae7 +[NSException raise:format:arguments:] + 103
        3   CoreFoundation                      0x00007fff884d4a74 +[NSException raise:format:] + 148
        4   AppKit                              0x00007fff871b933a _NSCreateWindowWithOpaqueShape2 + 473
        5   AppKit                              0x00007fff8714d8d1 -[NSWindow _commonAwake] + 1214
        6   AppKit                              0x00007fff8716b5b9 -[NSWindow _makeKeyRegardlessOfVisibility] + 96
        7   AppKit                              0x00007fff8716b52e -[NSWindow makeKeyAndOrderFront:] + 24
        8   libnewt.jnilib                      0x0000000119e95f5c Java_com_sun_javafx_newt_macosx_MacWindow_makeKeyAndOrderFront + 110
        9   ???                                 0x0000000102011c48 0x0 + 4328594504
        10  ???                                 0x000000010200681a 0x0 + 4328548378
)
terminate called after throwing an instance of 'NSException'
Reply | Threaded
Open this post in threaded view
|

Re: NEWT previously working on OS X, now fail :(

gouessej
Administrator
Hi!

You wrote it was working some months ago. Do you know exactly which revision broke it?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NEWT previously working on OS X, now fail :(

Christian Catchpole
Yeah, thats the weird thing.  My last code revision was working fine.  The only thing that has changed is time.  So I'm thinking it's something specific to my system.  A software update or some such.  I try not to post with "hey it's broken" questions as its usually something I can debug myself.  But this one is weird.  Especially since I'm getting the same results with the older version of JOGL (not sure which one, but it's the old package structure).  So i forked my project and updated to the current version of JOGL.  Same result.  I guess I'll work through some NEWT examples and see if they fail in the same way.

I'v been using -XstartOnFirstThread of course.

I'v boiled it down to breaking on window.setVisable(true) with NSInternalInconsistencyException

        this.display = NewtFactory.createDisplay(null);
        GLCapabilities capabilities = new GLCapabilities(GLProfile.get(GLProfile.GL2));
        this.screen = NewtFactory.createScreen(display, 0);
        this.window = NewtFactory.createWindow(screen, capabilities, false);
        this.window.setVisible(true);

Debugger results - the screen and windows have no handles....

capabilities = {javax.media.opengl.GLCapabilities@1011}"GLCapabilities[Capabilities[Onscreen: true, Red: 8, Green: 8, Blue: 8, Alpha: 0, Opaque: true], GL profile: GLProfile[GL2/GL2], PBuffer: false, DoubleBuffered: true, Stereo: false, HardwareAccelerated: true, DepthBits: 24, StencilBits: 0, Red Accum: 0, G...
this.screen = {com.jogamp.newt.impl.macosx.MacScreen@1394}

aScreen = {javax.media.nativewindow.DefaultGraphicsScreen@1492}"class javax.media.nativewindow.DefaultGraphicsScreen[class javax.media.nativewindow.macosx.MacOSXGraphicsDevice[type MacOSX, handle 0x0], idx 0]"

aScreen.handle = 0
display.aDevice.handle = 0

this.window = {com.jogamp.newt.impl.macosx.MacWindow@1464}

On window....

windowHandle = 0
surfaceHandle = 0
parentWindowHandle = 0

Reply | Threaded
Open this post in threaded view
|

Re: NEWT previously working on OS X, now fail :(

Christian Catchpole
OK, I'v isolated to an interaction with AWT.  Before setting up the NEWT window I load some images with AWT and convert them to JOGL images.  This had always worked just fine.  I'v always set java.awt.headless=true. In this case its still kicking in and interfering with JOGL.

I don't recall an OS X Java update recently.  Unless it's deciding to use hardware because of some other metric I don't know about.  Or it was just some random timing / side effect.

Anyway, so that answers the question... kind of :)
Reply | Threaded
Open this post in threaded view
|

Re: NEWT previously working on OS X, now fail :(

Christian Catchpole
Ok, i'v got it working again by ensuring no AWT satis-f-action occurs until the NEWT windows are set up. Happy days.
Reply | Threaded
Open this post in threaded view
|

Re: NEWT previously working on OS X, now fail :(

gouessej
Administrator
You load your images after the NEWT windows are ready, don't you?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NEWT previously working on OS X, now fail :(

Christian Catchpole
Yeah, I'v worked out that was the problem.  The thing that threw me was that I was definitely loading my images before setting up NEWT windows and it was working.  I guess it was always waiting to fail on me :).

I know it was in that order because of my source history and because now my NEWT window is grey for a few seconds while it does the AWT stuff.  I didn't have that before.

Anyway, a problem solved is... a.. problem solved? :)

Thanks guys,
Christian
Reply | Threaded
Open this post in threaded view
|

Re: NEWT previously working on OS X, now fail :(

gouessej
Administrator
It is important to understand how you solved your problem in order to be able to solve it again if someone else is in the same case. Best regards.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NEWT previously working on OS X, now fail :(

Christian Catchpole
oh i totally agree.. thats why i was so perplexed about why it seemed to stop working with no code changes.  there is always the risk it fails after a project is packaged and released.  or it works for me but fails for other people and i never know about it.