LWJGL / lwjgl3-demos

Demo suite for LWJGL 3
BSD 3-Clause "New" or "Revised" License
351 stars 89 forks source link

Assertion failure in +[NSUndoManager _endTopLevelGroupings], #27

Closed clankill3r closed 5 years ago

clankill3r commented 5 years ago

When I try the demos I get errors like:

2019-10-08 22:01:32.831 java[90338:13656789] WARNING: nextEventMatchingMask should only be called from the Main Thread! This will throw an exception in the future. 2019-10-08 22:01:32.831 java[90338:13656789] Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1349.91/Misc.subproj/NSUndoManager.m:363 2019-10-08 22:01:32.832 java[90338:13656789] Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1349.91/Misc.subproj/NSUndoManager.m:363 2019-10-08 22:01:32.833 java[90338:13656789] 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 0x00007fff8425a57b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00007fff994b91da objc_exception_throw + 48 2 CoreFoundation 0x00007fff8425f132 +[NSException raise:format:arguments:] + 98 3 Foundation 0x00007fff85cc6be0 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195 4 Foundation 0x00007fff85c51093 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170 5 AppKit 0x00007fff81cbc4ed -[NSApplication run] + 1200 6 libglfw.dylib 0x0000000119228a65 libglfw.dylib + 68197 7 libglfw.dylib 0x0000000119222455 libglfw.dylib + 42069 8 ??? 0x000000011a112667 0x0 + 4732298855 9 ??? 0x000000011a101dd0 0x0 + 4732231120 10 ??? 0x000000011a101dd0 0x0 + 4732231120 11 ??? 0x000000011a101dd0 0x0 + 4732231120 ) libc++abi.dylib: terminating with uncaught exception of type NSException Abort trap: 6

This is either after executing:

./mvnw package
java -jar target/lwjgl3-demos.jar

or:

./mvnw package -Dclass=opengl.UniformArrayDemo
java -cp target/lwjgl3-demos.jar org.lwjgl.demo.opengl.UniformArrayDemo

OSX 10.12.6

httpdigest commented 5 years ago

Mac OS requires the use of the -XstartOnFirstThread JVM argument, so: java -XstartOnFirstThread -jar target/lwjgl3-demos.jar See: https://stackoverflow.com/questions/28149634/what-does-the-xstartonfirstthread-vm-argument-do-mean

clankill3r commented 5 years ago

Damn that was quick.

Ok I have a new error now:

Press 'up' or 'down' to cycle through some colors. ERROR: 0:5: '' : version '130' is not supported ERROR: 0:6: '' : #version required and missing.

java.lang.AssertionError: Could not compile shader at org.lwjgl.demo.opengl.UniformArrayDemo.createShader(UniformArrayDemo.java:203) at org.lwjgl.demo.opengl.UniformArrayDemo.createRasterProgram(UniformArrayDemo.java:215) at org.lwjgl.demo.opengl.UniformArrayDemo.init(UniformArrayDemo.java:144) at org.lwjgl.demo.opengl.UniformArrayDemo.run(UniformArrayDemo.java:273) at org.lwjgl.demo.opengl.UniformArrayDemo.main(UniformArrayDemo.java:290)

I found this issue: https://github.com/LWJGL/lwjgl3/issues/38

Where it tells to:

You have to explicitly request a 3.2 core context when creating the GLFW window.

glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);

But looking into the source files it already is like this.

httpdigest commented 5 years ago

Try changing the version in the uniformarray-vs.glsl and uniformarray-fs.glsl to #version 150 and please tell me, whether this works. This corresponds to the GLSL version for OpenGL 3.2.

clankill3r commented 5 years ago

Thank you so much, I got one demo running! What is the best way to check all the demos? Changing those 2 commands to check all demos will take me days:

./mvnw package -Dclass=opengl.UniformArrayDemo
java -cp target/lwjgl3-demos.jar org.lwjgl.demo.opengl.UniformArrayDemo
httpdigest commented 5 years ago

The best is obviously to use an IDE (IntelliJ IDEA, Eclipse, NetBeans, ...). All of those have excellent Maven integration and running a demo is as easy as using the "Run this Java file" command that every IDE provides.

clankill3r commented 5 years ago

Ok thanks, I think I will manage from here.