Bad bad bad!

Ok, heres the deal. The game works on my ti4200 at home but when I try to run it on my Fujitsu Siemens c1020 laptop I get lots of errors. I havent tried the lwjgl from AF yet, could it fix my error?
What happens is that the display is shown and then it crashes before it draws anything.



An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x0
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.


Current Java thread:
      at org.lwjgl.opengl.GL.wglSwapIntervalEXT(Native Method)
      at Schlug.initGL(Schlug.java:158)
      at Schlug.run(Schlug.java:43)
      at java.lang.Thread.run(Thread.java:536)

Dynamic libraries:
0x00400000 - 0x00406000       C:\WINNT\system32\java.exe
0x77F80000 - 0x77FF9000       C:\WINNT\System32\ntdll.dll
0x77DB0000 - 0x77E0A000       C:\WINNT\system32\ADVAPI32.dll
0x77E80000 - 0x77F36000       C:\WINNT\system32\KERNEL32.DLL
0x77D40000 - 0x77DAF000       C:\WINNT\system32\RPCRT4.DLL
0x78000000 - 0x78046000       C:\WINNT\system32\MSVCRT.dll
0x6D340000 - 0x6D46A000       C:\Program Files\Java\j2re1.4.1_02\bin\client\jvm.dll
0x77E10000 - 0x77E75000       C:\WINNT\system32\USER32.dll
0x77F40000 - 0x77F7C000       C:\WINNT\system32\GDI32.DLL
0x77570000 - 0x775A0000       C:\WINNT\system32\WINMM.dll
0x6D1E0000 - 0x6D1E7000       C:\Program Files\Java\j2re1.4.1_02\bin\hpi.dll
0x6D310000 - 0x6D31E000       C:\Program Files\Java\j2re1.4.1_02\bin\verify.dll
0x6D220000 - 0x6D239000       C:\Program Files\Java\j2re1.4.1_02\bin\java.dll
0x6D330000 - 0x6D33D000       C:\Program Files\Java\j2re1.4.1_02\bin\zip.dll
0x10000000 - 0x1003B000       D:\java\a\lwjgl.dll
0x5F580000 - 0x5F61F000       C:\WINNT\system32\DINPUT.dll
0x69510000 - 0x695D7000       C:\WINNT\system32\OPENGL32.dll
0x6FAC0000 - 0x6FADF000       C:\WINNT\system32\GLU32.dll
0x51000000 - 0x5104A000       C:\WINNT\system32\DDRAW.dll
0x728A0000 - 0x728A6000       C:\WINNT\system32\DCIMAN32.dll
0x6E420000 - 0x6E426000       C:\WINNT\System32\INDICDLL.dll
0x75E60000 - 0x75E7A000       C:\WINNT\System32\IMM32.dll
0x6F9A0000 - 0x6F9A7000       C:\WINNT\system32\HID.DLL
0x77890000 - 0x7791D000       C:\WINNT\system32\SETUPAPI.DLL
0x77C10000 - 0x77C6D000       C:\WINNT\system32\USERENV.DLL
0x71710000 - 0x71794000       C:\WINNT\system32\COMCTL32.dll
0x770B0000 - 0x770B7000       C:\WINNT\system32\CFGMGR32.DLL
0x110B0000 - 0x11194000       C:\WINNT\system32\nbicdnt.dll
0x77920000 - 0x77942000       C:\WINNT\system32\imagehlp.dll
0x72A00000 - 0x72A2D000       C:\WINNT\system32\DBGHELP.dll
0x690A0000 - 0x690AB000       C:\WINNT\system32\PSAPI.DLL

Local Time = Thu Apr 03 10:25:41 2003
Elapsed Time = 1
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.1_02-b06 mixed mode)
#


I think I isolated the error in my code. Why would this cause this bad?

gl.wglSwapIntervalEXT(1); // Minimum number of frames before swapping

It’s an extension (there’s a EXT at the end of the function name), so are you checking if the EXT_swap_interval extension is available? It won’t run on linux or mac in the first place either, because it’s a WGL function.

  • elias

what´s WGL? :slight_smile:

A bit more info for you:

Base OpenGL functions are prefixed by “gl” - glColor3f, glVertex2i etc. The GLU functions are prefixed with “glu”, GLUT functions are prefixed by “glut”. There are also platform-dependent functions - Windows prefixes these with “wgl”, UNIX/X with “glx”, Apple/MacOS with “agl”.

The extension system exists to allow incremental updates to the OpenGL library, potentially only supported on one platform or with one piece of hardware. nVidia produce their own extensions as do ATI, Mesa etc. You need to check for the existence of a particular extension on a platform before using it - it may not exist.

Edit: Fixed typo

Using the debug version of the library, enabled with the -ea JVM switch to enable assertions, will throw an OpenGLException if you try to call functions that aren’t implemented. I recommend you always use -ea when doing any development and testing :slight_smile: It might have saved me a bunch of hassle in Alien Flux except that Jet behaves a bit weirdly with assertions and the like and causes the feature not to work properly.

Cas :slight_smile:

Is there any way to get these exceptions or in any other way check if the extension is available?

Also when I disabled this extension the drawings seemed a little strange, I am apparently not a opengl expert, so I am wondering if there is any other feature that would help me do the same thing platform and gfx independant?
Btw big cheers once again to lwjgl. It gives me 100+ fps on my crappy gfx card on my laptop :slight_smile:

Sure, do a

if (org.lwjgl.opengl.GL.WGL_EXT_swap_control)
// ext is available
else
// ext is not avaliable

  • elias

Excellent!
Is this a efficient way of doing things or should I simply skip all EXT methods? (seems rather dumb imo :wink:

Oh btw thanks for the lesson cmfdobbie, enlightened me quite a bit :slight_smile:

It depends on the extension - the swap_control extension simply forces the buffer swaps to sync with the refresh rate of your monitor. So ignoring it will simply make your app run at the fastest possible rate possible. Other extensions might be more difficult to ignore, like multitexturing.

  • elias

ok :slight_smile: