Mac fullscreen problem

Started by napier, March 06, 2005, 04:28:50

Previous topic - Next topic

napier

Anybody have fullscreen working on the Mac?  Any known bugs in this area?

My app works fine in a window, but in fullscreen I get a completely blank screen.  The app is running, not frozen (debug output shows that mouse events are getting through).  I'm a Mac newbie so maybe some OS tweak is necessary?

lwjgl .95
Powerbook G4 17" display 1440x900
ATI Mobility Radeon 9700 (128 MB)
penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl

princec

What OS is it? 10.2 or 10.3?

Cas :)

napier

penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl

napier

Trying to narrow down this fullscreen error...   I ran the FullScreenWindowedTest demo on the Mac and got the same results:  when in fullscreen mode I get a blank screen.  When I switch back to windowed mode the app works fine.

On the >>second<< switch to fullscreen I get this error:

java.lang.OutOfMemoryError
        at java.nio.Bits.reserveMemory(Bits.java:619)
        at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
        at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:285)
        at apple.awt.DataBufferNIOInt.getBufferOfSize(DataBufferNIOInt.java:135)
        at apple.awt.DataBufferNIOInt.<init>(DataBufferNIOInt.java:31)
        at apple.awt.FullscreenRaster.createFullscreenRaster(FullscreenRaster.java:30)
        at apple.awt.CComponent.createFrontBuffer(CComponent.java:417)
        at apple.awt.ContainerModel.replaceSurfaceData(ContainerModel.java:539)
        at apple.awt.ContainerModel.paintDamagedArea(ContainerModel.java:102)
        at apple.awt.PeerPaintEvent.dispatch(PeerPaintEvent.java:180)
        at apple.awt.CocoaEvent$1.run(CocoaEvent.java:86)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
        at apple.awt.CocoaEvent.dispatch(CocoaEvent.java:45)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

I tried running the app with 360m of memory but still got the error.  Maybe this is just fallout from whatever else is going wrong with fullscreen?  

I tried various screen resolutions, got the same results.

Specs are:
Powerbook G4 17" display 1440x900
OS X version 10.3.7
ATI Mobility Radeon 9700 (128 MB)
lwjgl .95

I'm in over my head on this one.... never developed code on a Mac.  I'm happy to run more tests if anybody can suggest things to try.
penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl

elias

No idea what is causing this. One thing you could try is to run a JOGL application in fullscreen. If that works, we can take it from there.

- elias

princec

I can pretty much figure out what's going wrong though and it's not your fault... Apple's AWT allocates a direct byte buffer for some reason for the entire screen. However, direct buffers are not garbage collected when memory gets tight; they exist outside the Java heap, in the C heap, and have a different set of parameters governing the maximum allocation allowed (I forget what they are). So when you try to get another fullscreen, it tries to allocate a second huge buffer without deallocating the first, and runs out of memory. Better report that one to Apple.

Cas :)

napier

Thanks Cas.  That explains the memory error the second time I run the app, but there's still the question of why I see nothing the first time I run (no error message, app appears to be running, just a blank screen).

I tried running a straight Java display mode test:

http://java.sun.com/docs/books/tutorial/extra/fullscreen/example-1dot4/DisplayModeTest.java

to see if I could anything on fullscreen, and it does work.
penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl

napier

I tested JOGL fullscreen on OS X and it fails as well, also showing a plain blank screen.  I used the Gears demo and set fullscreen like so:

     frame.setSize(1024, 768);
      frame.setLocation(0, 0);
      java.awt.GraphicsEnvironment GE = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
      java.awt.GraphicsDevice GD = GE.getDefaultScreenDevice();
      frame.setUndecorated(true);
      if (GD.isFullScreenSupported()) {
         System.out.println("FullScreenSupported :)");
         GD.setFullScreenWindow(frame);
      }


I'm no JOGL pro so I don't know it there's a better way to do fullscreen, but this worked fine on Windows.  Also the code reports "FullScreenSupported" so it looks like the fullscreen part is working, but opengl rendering is not getting through to the window (?).

So the score so far for Fullscreen in OSX:
LWJGL .95 -->Doesn't work
JOGL -----> Doesn't work
Sun/Swing--> Works
penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl

renanse

That's all very odd.  Using jME/LWJGL .94 we showed off jME at GDC full screen no problems. 15" PowerMac G4 1.5GHz, OS 10.3.7, 1GB RAM, same graphics card (basically same computer, just 15" screen and maybe more mem?)  Try one of our demos (such as this one) in full screen...  If it works, maybe it's a lwjgl .94 / .95 difference?

BatKid

I'm running OSX 10.3.8, 512Mb RAM, with LWJGL 0.95 on my mac mini and everything seems to be working fine, including full screen.
Projects: 
   Env3D (http://env3d.org): Learn Java in 3D
   WhaleChat (http://whalechat.com): A 3D social programming experiment

napier

Thanks for the link renanse.  It doesn't run fullscreen on my Mac either.  So that demo is LWJGL version .94?

Maybe it's an issue with the wide screen (1440x900)?  I've tried other displaymodes but all fail the same way.

BatKid, are you running a 15" screen too (I mean not one of the cinematic shaped screens)?
penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl

BatKid

I'm running it on a ancient 17" MAG CRT
Projects: 
   Env3D (http://env3d.org): Learn Java in 3D
   WhaleChat (http://whalechat.com): A 3D social programming experiment