SetFullScreen Issue

Back in 2005 I wrote a 16k program for the never-happened LWJGL16k comp. I noticed a while back that it no longer worked and decided to
recompile it against LWJGL 2.3 (The point being it hasn’t been compiled since LWJGL 0.98!)

I compiled against Java 1.5 libraries. Might try 1.6 just in case.

I found it crashes if I go full screen after creating a display context, but works if use the setDisplayModeAndFullScreen() call.
This laptop’s got an Intel GMA 4500 chipset, so nothing special. Could be drivers are not up to it. But there is a horrid not handled exception


Dodgy code
            DisplayMode modes[] = Display.getAvailableDisplayModes();
            for (int i=0; i< modes.length; i++) {
               DisplayMode m = modes[i];
               int bpp = Display.getDisplayMode().getBitsPerPixel();
               if (m.getBitsPerPixel() == bpp
                ) {
                   if ( m.getWidth() <= 800 && m.getHeight() <= 600 &&
                        m.getFrequency() <= 85)
                       mode = m;
                   if ( m.getWidth() == 800 && m.getHeight() == 600 &&
                        m.getFrequency() == 60)
                       break;
                   }
            }
                       
            Display.setDisplayMode(mode);
//Display.setDisplayModeAndFullscreen(mode);
            Display.create();
            Display.setFullscreen(true);


If I use setDisplayModeAndFullScreen(mode) and comment out the other mode & fullscreen code, all is fine (unless I try to change fullscreen mode later, when we crash again.)


---------------  T H R E A D  ---------------

Current thread (0x005c79f8):  JavaThread "main" [_thread_in_native, id=4268]

siginfo: ExceptionCode=0xc0000005, writing address 0x00000140

Registers:
EAX=0x00000000, EBX=0x4c011242, ECX=0x00283980, EDX=0x00000012
ESP=0x0006f598, EBP=0x00283d18, ESI=0x04a70068, EDI=0x00283980
EIP=0x044c1fa6, EFLAGS=0x00010202

Top of Stack: (sp=0x0006f598)
0x0006f598:   002906d0 00283980 04a70068 04b2fed0
0x0006f5a8:   0006fb84 0493ba68 00000000 046f5491
0x0006f5b8:   00000001 00290630 00000000 00000000
0x0006f5c8:   0006f700 000805dc 000010ac 7702f0e7
0x0006f5d8:   001eb7c0 00000002 001ed020 00216110
0x0006f5e8:   77018822 0006f608 7702f0e7 001ecea0
0x0006f5f8:   00000002 001ecf20 00216038 77018822
0x0006f608:   0006f624 7702f0e7 001eb7c0 00000002 

Instructions: (pc=0x044c1fa6)
0x044c1f96:   8d 00 00 8b ce e8 f0 98 00 00 8b 86 fc 80 00 00
0x044c1fa6:   83 80 40 01 00 00 ff 75 13 8b 88 3c 01 00 00 85 


Stack: [0x00030000,0x00070000),  sp=0x0006f598,  free space=253k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [ig4icd32.dll+0x31fa6]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.opengl.WindowsContextImplementation.nMakeCurrent(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V+0
j  org.lwjgl.opengl.WindowsContextImplementation.makeCurrent(Lorg/lwjgl/opengl/PeerInfo;Ljava/nio/ByteBuffer;)V+7
j  org.lwjgl.opengl.Context.makeCurrent()V+46
j  org.lwjgl.opengl.Display.makeCurrent()V+25
j  org.lwjgl.opengl.Display.makeCurrentAndSetSwapInterval()V+0
j  org.lwjgl.opengl.Display.setDisplayModeAndFullscreenInternal(ZLorg/lwjgl/opengl/DisplayMode;)V+88
j  org.lwjgl.opengl.Display.setFullscreen(Z)V+4
J  G.<init>()V
v  ~OSRAdapter
j  G.main([Ljava/lang/String;)V+4
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x037ed1d0 JavaThread "Thread-1" daemon [_thread_in_native, id=5520]
  0x0155aad8 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5684]
  0x015890a0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3060]
  0x0155a950 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3356]
  0x01559030 JavaThread "Finalizer" daemon [_thread_blocked, id=1872]
  0x01558268 JavaThread "Reference Handler" daemon [_thread_blocked, id=1768]
=>0x005c79f8 JavaThread "main" [_thread_in_native, id=4268]

Other Threads:
  0x01581c78 VMThread [id=3216]
  0x0154aa20 WatcherThread [id=3584]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 576K, used 558K [0x239a0000, 0x23a40000, 0x23e80000)
  eden space 512K,  96% used [0x239a0000, 0x23a1bac8, 0x23a20000)
  from space 64K,  99% used [0x23a30000, 0x23a3fff8, 0x23a40000)
  to   space 64K,   0% used [0x23a20000, 0x23a20000, 0x23a30000)
 tenured generation   total 2528K, used 1831K [0x23e80000, 0x240f8000, 0x279a0000)
   the space 2528K,  72% used [0x23e80000, 0x24049df0, 0x24049e00, 0x240f8000)
 compacting perm gen  total 8192K, used 1210K [0x279a0000, 0x281a0000, 0x2b9a0000)
   the space 8192K,  14% used [0x279a0000, 0x27acea28, 0x27acec00, 0x281a0000)
    ro space 8192K,  67% used [0x2b9a0000, 0x2bf04558, 0x2bf04600, 0x2c1a0000)
    rw space 12288K,  47% used [0x2c1a0000, 0x2c750a70, 0x2c750c00, 0x2cda0000)

Dynamic libraries:
0x00400000 - 0x0040d000 	C:\Program Files\Java\jdk1.5.0_21\bin\java.exe
0x76fd0000 - 0x7710c000 	C:\Windows\SYSTEM32\ntdll.dll
0x769b0000 - 0x76a84000 	C:\Windows\system32\kernel32.dll
0x751a0000 - 0x751ea000 	C:\Windows\system32\KERNELBASE.dll
0x76860000 - 0x76900000 	C:\Windows\system32\ADVAPI32.dll
0x767b0000 - 0x7685c000 	C:\Windows\system32\msvcrt.dll
0x771e0000 - 0x771f9000 	C:\Windows\SYSTEM32\sechost.dll
0x76320000 - 0x763c1000 	C:\Windows\system32\RPCRT4.dll
0x6d740000 - 0x6d8de000 	C:\Program Files\Java\jdk1.5.0_21\jre\bin\client\jvm.dll
0x766e0000 - 0x767a9000 	C:\Windows\system32\USER32.dll
0x75430000 - 0x7547e000 	C:\Windows\system32\GDI32.dll
0x75420000 - 0x7542a000 	C:\Windows\system32\LPK.dll
0x763d0000 - 0x7646d000 	C:\Windows\system32\USP10.dll
0x744b0000 - 0x744e2000 	C:\Windows\system32\WINMM.dll
0x76200000 - 0x7621f000 	C:\Windows\system32\IMM32.DLL
0x75480000 - 0x7554c000 	C:\Windows\system32\MSCTF.dll
0x75050000 - 0x7509b000 	C:\Windows\system32\apphelp.dll
0x6d300000 - 0x6d308000 	C:\Program Files\Java\jdk1.5.0_21\jre\bin\hpi.dll
0x76a90000 - 0x76a95000 	C:\Windows\system32\PSAPI.DLL
0x6d710000 - 0x6d71c000 	C:\Program Files\Java\jdk1.5.0_21\jre\bin\verify.dll
0x6d380000 - 0x6d39d000 	C:\Program Files\Java\jdk1.5.0_21\jre\bin\java.dll
0x6d730000 - 0x6d73f000 	C:\Program Files\Java\jdk1.5.0_21\jre\bin\zip.dll
0x10000000 - 0x10016000 	C:\User\Java\SharpShooter16K\native\jinput-dx8.dll
0x67a60000 - 0x67a90000 	C:\Windows\system32\DINPUT8.dll
0x73cd0000 - 0x73d10000 	C:\Windows\system32\uxtheme.dll
0x73a00000 - 0x73a09000 	C:\Windows\system32\HID.DLL
0x76470000 - 0x7660d000 	C:\Windows\system32\SETUPAPI.DLL
0x75280000 - 0x752a7000 	C:\Windows\system32\CFGMGR32.dll
0x76aa0000 - 0x76b2f000 	C:\Windows\system32\OLEAUT32.dll
0x76d30000 - 0x76e8c000 	C:\Windows\system32\ole32.dll
0x75400000 - 0x75412000 	C:\Windows\system32\DEVOBJ.dll
0x752b0000 - 0x752dd000 	C:\Windows\system32\WINTRUST.dll
0x752e0000 - 0x753fc000 	C:\Windows\system32\CRYPT32.dll
0x75190000 - 0x7519c000 	C:\Windows\system32\MSASN1.dll
0x73380000 - 0x733a1000 	C:\Windows\system32\ntmarta.dll
0x76900000 - 0x76945000 	C:\Windows\system32\WLDAP32.dll
0x739e0000 - 0x739f3000 	C:\Windows\system32\dwmapi.dll
0x03dd0000 - 0x03de5000 	C:\User\Java\SharpShooter16K\native\jinput-raw.dll
0x03e80000 - 0x03ebf000 	C:\User\Java\SharpShooter16K\native\lwjgl.dll
0x672e0000 - 0x673a8000 	C:\Windows\system32\OPENGL32.dll
0x67570000 - 0x67592000 	C:\Windows\system32\GLU32.dll
0x6d5f0000 - 0x6d6d7000 	C:\Windows\system32\DDRAW.dll
0x6d5e0000 - 0x6d5e6000 	C:\Windows\system32\DCIMAN32.dll
0x74620000 - 0x74629000 	C:\Windows\system32\VERSION.dll
0x751f0000 - 0x75274000 	C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16385_none_ebf82fc36c758ad5\COMCTL32.dll
0x04490000 - 0x04a62000 	C:\Windows\system32\ig4icd32.dll
0x04c10000 - 0x04fce000 	C:\Windows\system32\ig4dev32.dll
0x750a0000 - 0x750ac000 	C:\Windows\system32\CRYPTBASE.dll
0x76610000 - 0x76693000 	C:\Windows\system32\CLBCatQ.DLL
0x71680000 - 0x716f9000 	C:\Windows\system32\mscms.dll
0x74780000 - 0x74797000 	C:\Windows\system32\USERENV.dll
0x75120000 - 0x7512b000 	C:\Windows\system32\profapi.dll
0x672a0000 - 0x672d8000 	C:\Windows\system32\icm32.dll

VM Arguments:
jvm_args: -Dfile.encoding=UTF-8
java_command: G
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\Windows\System32\WindowsPowerShell\v1.0\
USERNAME=Alan
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 10, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows 7 Build 7600 

CPU:total 2 (cores per cpu 2, threads per core 1) family 6 model 7 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2

Memory: 4k page, physical 2097151k(1678776k free), swap 4194303k(4194303k free)

vm_info: Java HotSpot(TM) Client VM (1.5.0_21-b01) for windows-x86, built on Aug 24 2009 12:50:05 by "java_re" with MS VC++ 6.0

time: Mon Feb 22 21:49:13 2010
elapsed time: 2 seconds

Tried


            mode = org.lwjgl.util.Display.setDisplayMode(
                   org.lwjgl.util.Display.getAvailableDisplayModes(
                   640, 480, -1, -1, 16, 32, 60, 85),
                   new String[] {"width=800", "height=600", "bpp="+
                   Display.getDisplayMode().getBitsPerPixel(), "freq=60"});
            Display.setDisplayMode(mode);
            Display.create();
            Display.setFullscreen(true);

Same problem, unless I move the setFullScreen() before Display.create();
Edit: I also tried setting width/height to my display’s native resolution - but still the same behaviour

So… I don’t appear to be able to go Full Screen once I’ve created the display context.

Edit

This looks suspiciously similar…
http://www.java-gaming.org/index.php/topic,20481.0.html#lastPost

looks similar … and lo and behold - same driver class :slight_smile: ig4icd32.dll vs igldev32.dll

Since I dont have the hardware, I cannot debug it - but very weird indeed

Destroying the display and then reseting mode, fullscreen and then recreating the display appears to work. I get no crashes. Works fine in setup code when I created the context, deliberately destroyed it, then proceded to set mode and full screen before creating a Display again.

Unfortunately the Full Screen/Window toggle code suffers in that I’m losing the rest of the opengl context setup. So no crashes, but only the 2D overlay is currently showing up, which is as expected.

I tried upgrading the drivers (using the windows automated feature) and it downloaded a new file, but this turned out to be a fancy new Control Panel Applet, with no change to the actual drivers.

Conclusion: I’ve reordered the calls in the initialisation code so it works and disabled the full screen/windowed toggle. I have a work around should I really want to put the toggle back in.

you could try and post the issue @ http://lwjgl.org/forum/index.php and see if there others with similar drivers with similar issues - and possibly able to debug the issues.