OpenGL rendering fallback

Scott Kovatch scott.kovatch at oracle.com
Fri Dec 16 16:39:48 PST 2011


Folks,

We're trying to get our nightly builds for the deploy stack to run automated tests via Hudson. Before I go through the hoops of setting up Hudson, changing the build configuration, etc. I tried running them via screen sharing and using a virtual/remote desktop for a user not logged in at the remote system. However, I ran into http://java.net/jira/browse/MACOSX_PORT-107, which is a startup crash in OpenGL.

After a lot of debug building and j2d debug logging I found that the problem was that we were failing to create an NSOpenGLPixelFormat object, bailing out, and not checking the result in CGLGraphicsConfig.getConfig(). I added "if (cfginfo != 0)" before calling getOGLIdString, but that just prevented a native crash; it still led to an NPE creating windows.

So, I saw this code:

        NSOpenGLPixelFormatAttribute attrs[] = {
            NSOpenGLPFAClosestPolicy,
            NSOpenGLPFANoRecovery,
	    NSOpenGLPFAAccelerated,
            NSOpenGLPFAFullScreen,
            NSOpenGLPFAWindow,
            NSOpenGLPFAPixelBuffer,
            NSOpenGLPFADoubleBuffer,
            NSOpenGLPFAColorSize, 32,
            NSOpenGLPFAAlphaSize, 8,
            NSOpenGLPFADepthSize, 16,
            NSOpenGLPFAScreenMask, glMask,
            0
        };

and I have to ask if it's absolutely necessary that we be this restrictive when creating an OpenGL context. Basically, if we can't get a fully hardware-accelerated renderer we just give up and return.

The docs for NSOpenGLPixelFormatAttribute say "This attribute is not generally useful". I think that's an understatement here. :-)

I did some experimenting with these options and I can get my tests to run in a screen-sharing window, but then the contents of the window don't draw, so I'm clearly getting out of my area of knowledge here.

Any help would be appreciated.

-- Scott K.



More information about the macosx-port-dev mailing list