2015-10-12 20 views
5

Java/LWJGL'de basit bir oyun yapmaya çalışıyorum. Pencerelerde yapılmış bir öğretici takip ediyordum ve bir mac kullanıyorum. Ben karakter için bir pencere karakteri açmak için onun kodunu kopyaladı ve program bana muhtemelen (ben aslında bilmiyorum) işaretçilerle bir ilgisi olan çok uzun ve garip bir hata vererek çöktü. Burada genişlik ve yükseklik özelliklerinden tanımlanmıştır kullandığım bir pencere oluşturmak için çizgidir:LWJGL: Açılış penceresi programın çökmesine neden oluyor

2015-10-12 13:18:38.475 java[496:31875] *** Assertion failure in + [NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-1154/Misc.subproj/NSUndoManager.m:340 
2015-10-12 13:18:38.476 java[496:31875] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread. 
2015-10-12 13:18:38.476 java[496:31875] (
0 CoreFoundation      0x00007fff98c3003c __exceptionPreprocess + 172 
1 libobjc.A.dylib      0x00007fff9620a76e objc_exception_throw + 43 
2 CoreFoundation      0x00007fff98c2fe1a +[NSException raise:format:arguments:] + 106 
3 Foundation       0x00007fff99f6199b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195 
4 Foundation       0x00007fff99ee364f +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 156 
5 AppKit        0x00007fff96ecbb95 -[NSApplication run] + 756 
6 libglfw.dylib      0x000000010d597974 initializeAppKit + 1332 
7 libglfw.dylib      0x000000010d597035 _glfwPlatformCreateWindow + 37 
8 libglfw.dylib      0x000000010d59397b glfwCreateWindow + 443 
9 ???         0x0000000104411eee 0x0 + 4366343918 
10 ???         0x0000000104406929 0x0 + 4366297385 
11 ???         0x0000000104406929 0x0 + 4366297385 
12 ???         0x0000000104406929 0x0 + 4366297385 
13 ???         0x000000010440685a 0x0 + 4366297178 
14 ???         0x0000000104406d34 0x0 + 4366298420 
) 
2015-10-12 13:18:38.477 java[496:31875] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-1154/Misc.subproj/NSUndoManager.m:340 
2015-10-12 13:18:38.477 java[496:31875] An uncaught exception was raised 
2015-10-12 13:18:38.477 java[496:31875] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread. 
2015-10-12 13:18:38.477 java[496:31875] (
0 CoreFoundation      0x00007fff98c3003c __exceptionPreprocess + 172 
1 libobjc.A.dylib      0x00007fff9620a76e objc_exception_throw + 43 
2 CoreFoundation      0x00007fff98c2fe1a +[NSException raise:format:arguments:] + 106 
3 Foundation       0x00007fff99f6199b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195 
4 Foundation       0x00007fff99ee364f +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 156 
5 AppKit        0x00007fff96ecbc41 -[NSApplication run] + 928 
6 libglfw.dylib      0x000000010d597974 initializeAppKit + 1332 
7 libglfw.dylib      0x000000010d597035 _glfwPlatformCreateWindow + 37 
8 libglfw.dylib      0x000000010d59397b glfwCreateWindow + 443 
9 ???         0x0000000104411eee 0x0 + 4366343918 
10 ???         0x0000000104406929 0x0 + 4366297385 
11 ???         0x0000000104406929 0x0 + 4366297385 
12 ???         0x0000000104406929 0x0 + 4366297385 
13 ???         0x000000010440685a 0x0 + 4366297178 
14 ???         0x0000000104406d34 0x0 + 4366298420 
) 
2015-10-12 13:18:38.478 java[496:31875] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.' 
*** First throw call stack: 
(
0 CoreFoundation      0x00007fff98c3003c __exceptionPreprocess + 172 
1 libobjc.A.dylib      0x00007fff9620a76e objc_exception_throw + 43 
2 CoreFoundation      0x00007fff98c2fe1a +[NSException raise:format:arguments:] + 106 
3 Foundation       0x00007fff99f6199b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195 
4 Foundation       0x00007fff99ee364f +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 156 
5 AppKit        0x00007fff96ecbc41 -[NSApplication run] + 928 
6 libglfw.dylib      0x000000010d597974 initializeAppKit + 1332 
7 libglfw.dylib      0x000000010d597035 _glfwPlatformCreateWindow + 37 
8 libglfw.dylib      0x000000010d59397b glfwCreateWindow + 443 
9 ???         0x0000000104411eee 0x0 + 4366343918 
10 ???         0x0000000104406929 0x0 + 4366297385 
11 ???         0x0000000104406929 0x0 + 4366297385 
12 ???         0x0000000104406929 0x0 + 4366297385 
13 ???         0x000000010440685a 0x0 + 4366297178 
14 ???         0x0000000104406d34 0x0 + 4366298420 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 

A: Ben mac çalıştırmak

window = glfwCreateWindow(width, height, "Flappy Bird", NULL, NULL); 

, bana bu hata veriyor pencere de açılır, "java libglfw.dylib eklentisini kullanırken beklenmedik şekilde çıkılır."

LWJGL'yi yanlış mı yükledim yoksa kodum hatalı mı? Yardım için teşekkürler!

<terminated> 
+0

Tüm istisnaları göz ardı etmemelisiniz. Bir istisna atın veya hemen geri döndüğünüz her yere bir mesaj yazdırın. Ayrıca, [glfwSetErrorCallback] (http://javadoc.lwjgl.org/org/lwjgl/glfw/GLFW.html#glfwSetErrorCallback (org.lwjgl.glfw.GLFWErrorCallback)) ile bir hata geri bildirimi ayarlamalı ve programınızı '- Dorg.lwjgl.util.Debug = TRUE. – javac

cevap

1

LWJGL 3 kullanıyorsanız, projenizi ve ekranınızı ayarlamak için Oskar'ın video eğitimini izlemenizi öneririz.

Display tutorial

Workspace setting

Ve glfwCreateWindow çağrısında MemoryUtil.NULL yerine standart null kullanmayı deneyin.

+1

'MemoryUtil.NULL 'uzun bir süre' null 'bir nesnedir, bu yüzden" bunun yerine kullanamazsınız ". – javac

İlgili konular