Git Product home page Git Product logo

lwjgl3-demos's Introduction

[LEGACY] LWJGL - Lightweight Java Game Library

WARNING

This is the repository of the original LWJGL, which is no longer actively maintained. Unless you have released a product that uses LWJGL 2.x, you should probably be looking at LWJGL 3.

The Lightweight Java Game Library (LWJGL) is a solution aimed directly at professional and amateur Java programmers alike to enable commercial quality games to be written in Java. LWJGL provides developers access to high performance crossplatform libraries such as OpenGL (Open Graphics Library), OpenCL (Open Computing Language) and OpenAL (Open Audio Library) allowing for state of the art 3D games and 3D sound. Additionally LWJGL provides access to controllers such as Gamepads, Steering wheel and Joysticks. All in a simple and straight forward API.

Website: http://legacy.lwjgl.org Forum: http://forum.lwjgl.org Bugs/Suggestions: https://github.com/LWJGL/lwjgl/issues

Compilation

LWJGL requires a JDK and Ant installed to compile, as well as your platforms native compiler to compile the JNI.

  • ant generate-all
  • ant compile
  • ant compile_native

lwjgl3-demos's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lwjgl3-demos's Issues

Intel UHD cards crash

Hi!

On Intel UHD cards the demo crashes, unless I set the canGenerateDrawCallsViaShader property to false (here). The error message is:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007fff5f0adbf7, pid=11684, tid=20596
#
# JRE version: OpenJDK Runtime Environment GraalVM CE 21.3.2 (11.0.15+10) (build 11.0.15+10-jvmci-21.3-b14)
# Java VM: OpenJDK 64-Bit Server VM GraalVM CE 21.3.2 (11.0.15+10-jvmci-21.3-b14, mixed mode, sharing, tiered, jvmci, jvmci compiler, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C  [igxelpicd64.dll+0x22dbf7]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:

or with debug:

[LWJGL] Loading library: opengl32
[LWJGL]         Module: org.lwjgl.opengl
[LWJGL]         opengl32.dll not found in org.lwjgl.librarypath=C:\Users\[DELETED]\3.3.2-SNAPSHOT
[LWJGL]         Loaded from system paths: C:\Windows\SYSTEM32\opengl32.dll
[LWJGL] Failed to locate address for GL function glNamedFramebufferTextureMultiviewOVR
[LWJGL] [GL] GL_OVR_multiview was reported as available but an entry point is missing.
useMultiDrawIndirect: true
useBufferStorage: true
drawPointsWithGS: true
useInverseDepth: true
useNvMultisampleCoverage: false
canUseSynchronousDebugCallback: true
canGenerateDrawCallsViaShader: true
useOcclusionCulling: true
useTemporalCoherenceOcclusionCulling: true
canSourceIndirectDrawCallCountFromBuffer: true
useRepresentativeFragmentTest: false
uniformBufferOffsetAlignment: 16
[LWJGL] [GL] Using KHR_debug for error logging.
[LWJGL] OpenGL debug message
        ID: 0x0
        Source: SHADER COMPILER
        Type: ERROR
        Severity: HIGH
        Message: SHADER_ID_COMPILE error has been generated. GLSL compile failed for shader 9, "": ERROR: 0:8: 'writeonly' : reserved word
ERROR: 0:8: 'writeonly' : syntax error syntax error


ERROR: 0:8: 'writeonly' : reserved word
ERROR: 0:8: 'writeonly' : syntax error syntax error


Exception in thread "main" java.lang.AssertionError: Could not compile shader: org/lwjgl/demo/game/voxelgame/boundingboxes.vs.glsl
        at org.lwjgl.demo.game.VoxelGameGL.createShader(VoxelGameGL.java:1623)
        at org.lwjgl.demo.game.VoxelGameGL.createBoundingBoxesProgram(VoxelGameGL.java:1803)
        at org.lwjgl.demo.game.VoxelGameGL.initGLResources(VoxelGameGL.java:3528)
        at org.lwjgl.demo.game.VoxelGameGL.run(VoxelGameGL.java:3477)
        at org.lwjgl.demo.game.VoxelGameGL.main(VoxelGameGL.java:3542)
[LWJGL] 56 bytes leaked, thread 1 (main), address: 0x233648B0190
        at org.lwjgl.system.Callback.create(Callback.java:163)
        at org.lwjgl.system.CallbackI.address(CallbackI.java:25)
        at org.lwjgl.system.MemoryUtil.memAddressSafe(MemoryUtil.java:850)
        at org.lwjgl.glfw.GLFW.glfwSetFramebufferSizeCallback(GLFW.java:3345)
        at org.lwjgl.demo.game.VoxelGameGL.registerWindowCallbacks(VoxelGameGL.java:1132)
        at org.lwjgl.demo.game.VoxelGameGL.run(VoxelGameGL.java:3473)
        at org.lwjgl.demo.game.VoxelGameGL.main(VoxelGameGL.java:3542)
[LWJGL] 56 bytes leaked, thread 1 (main), address: 0x233648B0210
        at org.lwjgl.system.Callback.create(Callback.java:163)
        at org.lwjgl.system.CallbackI.address(CallbackI.java:25)
        at org.lwjgl.system.MemoryUtil.memAddressSafe(MemoryUtil.java:850)
        at org.lwjgl.glfw.GLFW.glfwSetCursorPosCallback(GLFW.java:4121)
        at org.lwjgl.demo.game.VoxelGameGL.registerWindowCallbacks(VoxelGameGL.java:1134)
        at org.lwjgl.demo.game.VoxelGameGL.run(VoxelGameGL.java:3473)
        at org.lwjgl.demo.game.VoxelGameGL.main(VoxelGameGL.java:3542)
[LWJGL] 56 bytes leaked, thread 1 (main), address: 0x233648B0290
        at org.lwjgl.system.Callback.create(Callback.java:163)
        at org.lwjgl.system.CallbackI.address(CallbackI.java:25)
        at org.lwjgl.opengl.GLDebugMessageCallback.create(GLDebugMessageCallback.java:54)
        at org.lwjgl.opengl.GLUtil.setupDebugMessageCallback(GLUtil.java:63)
        at org.lwjgl.opengl.GLUtil.setupDebugMessageCallback(GLUtil.java:30)
        at org.lwjgl.demo.game.VoxelGameGL.installDebugCallback(VoxelGameGL.java:1187)
        at org.lwjgl.demo.game.VoxelGameGL.initGLResources(VoxelGameGL.java:3512)
        at org.lwjgl.demo.game.VoxelGameGL.run(VoxelGameGL.java:3477)
        at org.lwjgl.demo.game.VoxelGameGL.main(VoxelGameGL.java:3542)
[LWJGL] 56 bytes leaked, thread 1 (main), address: 0x233648B01D0
        at org.lwjgl.system.Callback.create(Callback.java:163)
        at org.lwjgl.system.CallbackI.address(CallbackI.java:25)
        at org.lwjgl.system.MemoryUtil.memAddressSafe(MemoryUtil.java:850)
        at org.lwjgl.glfw.GLFW.glfwSetKeyCallback(GLFW.java:3985)
        at org.lwjgl.demo.game.VoxelGameGL.registerWindowCallbacks(VoxelGameGL.java:1133)
        at org.lwjgl.demo.game.VoxelGameGL.run(VoxelGameGL.java:3473)
        at org.lwjgl.demo.game.VoxelGameGL.main(VoxelGameGL.java:3542)
[LWJGL] 56 bytes leaked, thread 1 (main), address: 0x233648B0250
        at org.lwjgl.system.Callback.create(Callback.java:163)
        at org.lwjgl.system.CallbackI.address(CallbackI.java:25)
        at org.lwjgl.system.MemoryUtil.memAddressSafe(MemoryUtil.java:850)
        at org.lwjgl.glfw.GLFW.glfwSetMouseButtonCallback(GLFW.java:4091)
        at org.lwjgl.demo.game.VoxelGameGL.registerWindowCallbacks(VoxelGameGL.java:1135)
        at org.lwjgl.demo.game.VoxelGameGL.run(VoxelGameGL.java:3473)
        at org.lwjgl.demo.game.VoxelGameGL.main(VoxelGameGL.java:3542)

I accept if you don't change anything but it might worth a mention in the FAQ section, so others won't debug the same issue for as long as I have.

Thanks

Null pointer exception

Exception in thread "main" java.lang.NullPointerException
at org.lwjgl.demo.opengl.util.DemoUtils.ioResourceToByteBuffer(DemoUtils.java:143)
at org.lwjgl.demo.vulkan.ColoredTriangleDemo.loadShader(ColoredTriangleDemo.java:666)
at org.lwjgl.demo.vulkan.ColoredTriangleDemo.loadShader(ColoredTriangleDemo.java:687)
at org.lwjgl.demo.vulkan.ColoredTriangleDemo.createPipeline(ColoredTriangleDemo.java:884)
at org.lwjgl.demo.vulkan.ColoredTriangleDemo.main(ColoredTriangleDemo.java:1186)

public static ByteBuffer ioResourceToByteBuffer(String resource, int bufferSize) throws IOException { ByteBuffer buffer; URL url = Thread.currentThread().getContextClassLoader().getResource(resource); File file = new File(url.getFile()); // this line

Only compiling under windows (I assume)

I tried buidling on a linux machine and I end up with errors in SwtHelperWin32 no matter what I do. I've tried specifying the linux maven profiles.

To me it seems like this is caused by 33bd2b1

Error

lwjgl3-demos/src/org/lwjgl/demo/opengl/swt/SwtHelperWin32.java:[10,57] cannot find symbol
[ERROR] symbol:   variable OS
[ERROR] location: class org.lwjgl.demo.opengl.swt.SwtHelperWin32

Error: Requested OpenGL version 4.3, got version 4.1

Hi! I'm new to graphics programming and I am learning OpenGL. Thank you for this repo. I am learning a lot.

For most of the examples I get this error on my MacBook because Apple dropped support for OpenGL 4.3. I'm hoping there is a way around this or do I have to buy a non mac computer?

[LWJGL] GLFW_VERSION_UNAVAILABLE error
Description : Requested OpenGL version 4.3, got version 4.1

I'm slowly going through each example. Tried running examples in raytracing.tutorial package and I get that error.

Assertion failure in +[NSUndoManager _endTopLevelGroupings],

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

cant show image in mtl file

i load a model in wavefrontObjDemo, but image cant show, the image is in the mtl .why ?

newmtl rubber
Ka 1 1 1
Kd 0.80000001192093 0.80000001192093 0.80000001192093
map_Kd 40bOOOPICb3_1024.jpg
Ks 1 1 1
Ns 50
illum 7

BGFX demos don't work anymore with LWJGL 3.1.3-SNAPSHOT

They now only show the background color and sometimes even crash when closing the window.
This is likely just because of an API change in BGFX (even though the demos don't seem to be directly affected by it - no compile error).
Tested with JDK 8 b131 on Windows 7 x64.

Example crash log:

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [bgfx.dll+0x6c62]
C  0x0000000002af7f74

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.system.JNI.invokeV(JS)V+0
j  org.lwjgl.bgfx.BGFX.bgfx_destroy_program(S)V+6
j  org.lwjgl.demo.bgfx.Metaballs.dispose()V+25
j  org.lwjgl.demo.bgfx.Demo.run([Ljava/lang/String;)V+518
j  org.lwjgl.demo.bgfx.Metaballs.main([Ljava/lang/String;)V+8
v  ~StubRoutines::call_stub

Everything works fine with 3.1.2-SNAPSHOT.

Texture Demo for the vulkan demos?

The vulkan demo collection is pretty thorough with the basic ClearScreenDemo, 3D with depth (TwoRotatingTrianglesInvDepthDemo) and ray tracing.

I'm quite new to vulkan, and would like it if a textured quad demo could be added to the vulkan demos. I might end up writing it myself once I figure out this api in depth.

Synchronisation problem?

Hi, thanks for the wonderful introductions to Vulkan in LWJGL.

To prevent the following error when runnning InstancedSpheresDemo.java, I need to put Thread.sleep(40); before vkQueueWaitIdle(queue);:

[mvk-warn] VK_TIMEOUT: vkQueueWaitIdle timed out after 10 frames while awaiting 1 swapchain image presentations to complete.
ERROR OCCURED: VK_TIMEOUT: vkQueueWaitIdle timed out after 10 frames while awaiting 1 swapchain image presentations to complete.
libc++abi: terminating due to uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument

I don't think it's specific to this demo, this is just an example. I'm only starting to learn the Vulkan API so can't quite work out whether perhaps Host access to queue must be externally synchronised is violated, or there is some other reason for the timeout.

I'm using the JVM flag -XstartOnFirstThread because I'm on macOS; could that be relevant?

(repo revision, Vulkan 1.3.268.1 (MoltenVK), Java 17.0.4, macos 14.1.2, Intel Xeon W, Radeon Pro Vega 56)

Unable to load model in WavefrontObjDemo

Hello. WavefrontObjDemo fails to run due to file loading error. (/home/hara/java_dev/ is the directory containing clone of 7fc7dd4).

Move the mouse to look around
Zoom in/out with mouse wheel
java.lang.IllegalStateException: Unable to open file "/home/hara/java_dev/lwjgl3-demos/file:/home/hara/java_dev/lwjgl3-demos/target/lwjgl3-demos.jar!/org/lwjgl/demo/opengl/assimp/magnet.obj".
	at org.lwjgl.demo.opengl.assimp.WavefrontObjDemo.loadModel(WavefrontObjDemo.java:194)
	at org.lwjgl.demo.opengl.assimp.WavefrontObjDemo.init(WavefrontObjDemo.java:183)
	at org.lwjgl.demo.opengl.assimp.WavefrontObjDemo.run(WavefrontObjDemo.java:303)
	at org.lwjgl.demo.opengl.assimp.WavefrontObjDemo.main(WavefrontObjDemo.java:322)

Build and run steps:

$ mvn package -Dclass=opengl.assimp.WavefrontObjDemo
$ java -jar target/lwjgl3-demos.jar
$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
ID_LIKE=archlinux
ANSI_COLOR="0;36"
HOME_URL="https://www.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
$ java -version
openjdk version "1.8.0_172"
OpenJDK Runtime Environment (build 1.8.0_172-b11)
OpenJDK 64-Bit Server VM (build 25.172-b11, mixed mode)

SWT async recursion is bad for Eclipse RCP environment

Regarding the example at https://github.com/LWJGL/lwjgl3-demos/blob/master/src/org/lwjgl/demo/opengl/swt/SwtDemo.java

The proposed recursive call for
display.asyncExec(new Runnable() {
renderThings();
display.asyncExec( this )
}
means that the async job queue is never empty. When running in Eclipse RCP environment, repositioning parts of RCP application waits until the queue is finished, but since this never happens, an attempt to move parts causes the entire application to stuck forever.

Add support for OS X

Hi,

Some of your examples, do require a higher OpenGL version. I think it would be handy if you added theese lines of code to support OS X users, and force the OS to run OpenGL 3.0 or higher!

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

Throw `Vulkan layer VK_LAYER_KHRONOS_validation is not supported` error

OS name: macOS
OS version: 12.0.1
Java version: 11.0.12
running demo: vulkan.raytracing.SimpleSphere

logging:

$ java -XstartOnFirstThread  -cp target/lwjgl3-demos.jar org.lwjgl.demo.vulkan.raytracing.SimpleSphere
[LWJGL] Version: 3.3.0 SNAPSHOT
[LWJGL]          OS: Mac OS X v10.16
[LWJGL]         JRE: macOS x86_64 11.0.12
[LWJGL]         JVM: OpenJDK 64-Bit Server VM v11.0.12+7 by Eclipse Foundation
[LWJGL] Loading JNI library: lwjgl
[LWJGL]         Module: org.lwjgl
[LWJGL]         Using SharedLibraryLoader...
[LWJGL]         Found at: /var/folders/w2/pymyhlpx2b38ylvvypt63_ym0000gp/T/lwjglhuanghezhao/3.3.0-SNAPSHOT/liblwjgl.dylib
[LWJGL]         Loaded from org.lwjgl.librarypath: /var/folders/w2/pymyhlpx2b38ylvvypt63_ym0000gp/T/lwjglhuanghezhao/3.3.0-SNAPSHOT/liblwjgl.dylib
[LWJGL] Loading library: glfw
[LWJGL]         Module: org.lwjgl.glfw
[LWJGL]         Using SharedLibraryLoader...
[LWJGL]         Found at: /var/folders/w2/pymyhlpx2b38ylvvypt63_ym0000gp/T/lwjglhuanghezhao/3.3.0-SNAPSHOT/libglfw.dylib
[LWJGL]         Loaded from org.lwjgl.librarypath: /var/folders/w2/pymyhlpx2b38ylvvypt63_ym0000gp/T/lwjglhuanghezhao/3.3.0-SNAPSHOT/libglfw.dylib
[LWJGL] Loading library: MoltenVK
[LWJGL]         Module: org.lwjgl.vulkan
[LWJGL]         Using SharedLibraryLoader...
[LWJGL]         Found at: /var/folders/w2/pymyhlpx2b38ylvvypt63_ym0000gp/T/lwjglhuanghezhao/3.3.0-SNAPSHOT/libMoltenVK.dylib
[LWJGL]         Loaded from org.lwjgl.librarypath: /var/folders/w2/pymyhlpx2b38ylvvypt63_ym0000gp/T/lwjglhuanghezhao/3.3.0-SNAPSHOT/libMoltenVK.dylib
[LWJGL] Loading library: jemalloc
[LWJGL]         Module: org.lwjgl.jemalloc
[LWJGL]         Using SharedLibraryLoader...
[LWJGL]         Found at: /var/folders/w2/pymyhlpx2b38ylvvypt63_ym0000gp/T/lwjglhuanghezhao/3.3.0-SNAPSHOT/libjemalloc.dylib
[LWJGL]         Loaded from org.lwjgl.librarypath: /var/folders/w2/pymyhlpx2b38ylvvypt63_ym0000gp/T/lwjglhuanghezhao/3.3.0-SNAPSHOT/libjemalloc.dylib
[LWJGL] Closure Registry: simple
[LWJGL] MemoryUtil allocator: DebugAllocator
[mvk-error] VK_ERROR_LAYER_NOT_PRESENT: Vulkan layer VK_LAYER_KHRONOS_validation is not supported.
Exception in thread "main" java.lang.AssertionError: Failed to create VkInstance: A requested layer is not present or could not be loaded.
        at org.lwjgl.demo.vulkan.VKUtil._CHECK_(VKUtil.java:109)
        at org.lwjgl.demo.vulkan.raytracing.SimpleSphere.createInstance(SimpleSphere.java:262)
        at org.lwjgl.demo.vulkan.raytracing.SimpleSphere.init(SimpleSphere.java:1519)
        at org.lwjgl.demo.vulkan.raytracing.SimpleSphere.main(SimpleSphere.java:1608)
[LWJGL] 108 bytes leaked, thread 1 (main), address: 0x107F69000
        at org.lwjgl.glfw.GLFWVulkan.setPath(GLFWVulkan.java:355)
        at org.lwjgl.glfw.GLFWVulkan.setPath(GLFWVulkan.java:331)
        at org.lwjgl.glfw.GLFWVulkan.<clinit>(GLFWVulkan.java:44)
        at org.lwjgl.demo.vulkan.raytracing.SimpleSphere.initGlfwAndReturnRequiredExtensions(SimpleSphere.java:270)
        at org.lwjgl.demo.vulkan.raytracing.SimpleSphere.init(SimpleSphere.java:1518)
        at org.lwjgl.demo.vulkan.raytracing.SimpleSphere.main(SimpleSphere.java:1608)

Waiting for a KTX demo.

It's really hard to understand this stuff without docs or demo. PointerBuffer causes the process crash and i can't do anything

Access violation from stbi_load_from_memory

Hello.

I am encountering an exception access violation when loading image resources with org.lwjgl.stb.STBImage.stbi_load_from_memory. I have copied ioResourceToByteBuffer from lwjgl3-demos/src/org/lwjgl/demo/util/IOUtils.java into my project and am using it as the ByteBuffer input for stbi_load_from_memory. I can supply a crash report upon request.

As far as I can tell, I am using ioResourceToByteBuffer in the same way as demonstrated in the lwjgl3 demos, but I am calling it from multiple threads. There does not seem to be a pattern to when the crash occurs. Are there any synchronization issues or limitations for ioResourceToByteBuffer or stbi_load_from_memory?

I am open to any suggestions on how to debug this issue and willing to supply any information I can gather.

Vulkan demo fails to create image

I am using the NVIDIA 364.19 driver on an NVIDIA GeForce GT 750M in Ubuntu 16.04 LTS. I was able to build the demo suite just fine:

git clone https://github.com/LWJGL/lwjgl3-demos.git
cd lwjgl3-demos
mvn package

The SpaceGame demo runs without any problems:

java -jar target/lwjgl3-demos.jar

However, when I try to run one of the Vulkan demos:

java -cp target/lwjgl3-demos.jar org.lwjgl.demo.vulkan.ClearScreenDemo

A window titled "GLFW Vulkan Demo" appears for a split second, then the demo crashes with this error:

ERROR OCCURED: vkCreateImage: image creation failed due to invalid parameter
Exception in thread "main" java.lang.AssertionError: Failed to create swap chain: A validation layer found an error.
    at org.lwjgl.demo.vulkan.ClearScreenDemo.createSwapChain(ClearScreenDemo.java:502)
    at org.lwjgl.demo.vulkan.ClearScreenDemo.access$400(ClearScreenDemo.java:62)
    at org.lwjgl.demo.vulkan.ClearScreenDemo$1SwapchainRecreator.recreate(ClearScreenDemo.java:916)
    at org.lwjgl.demo.vulkan.ClearScreenDemo.main(ClearScreenDemo.java:997)

Is this a bug, or have I just not properly configured my system to use Vulkan?

tag the demos repo to match with the main LWJGL3 release

Can we have some tags matching the demos to be compatible with the LWJGL3 release?

Keeping the demos working with the latest and greatest features of LWJGL3 snapshot is great, but sometimes we need to run them against the official (current) release from Maven Central just to see what the demos are all about.

Currently I need to run the demos against the 3.2.3 version from Maven Central, and I'm having big trouble just to compile them. If we have some tag marking them compatible with the 3.2.3 release, it would be a great help.

Cannot run any demos on macOS 11.4

Unfortunately with both Java 11 and 16 I cannot start the demos.

Without specifying the main class, I get a crash:

FATAL ERROR in native method: Thread[Render Thread,10,main]: No context is current or a function that is not available in the current context was called. The JVM will abort execution.
	at org.lwjgl.opengl.GL30C.nglGenFramebuffers(Native Method)
	at org.lwjgl.opengl.GL30C.glGenFramebuffers(GL30C.java:1700)
	at org.lwjgl.demo.game.VoxelGameGL.createFramebufferObject(VoxelGameGL.java:1266)
	at org.lwjgl.demo.game.VoxelGameGL.lambda$onFramebufferSize$2(VoxelGameGL.java:979)
	at org.lwjgl.demo.game.VoxelGameGL$$Lambda$41/0x00000008000c6040.call(Unknown Source)
	at org.lwjgl.demo.game.VoxelGameGL.drainRunnables(VoxelGameGL.java:3580)
	at org.lwjgl.demo.game.VoxelGameGL.runUpdateAndRenderLoop(VoxelGameGL.java:3413)
	at org.lwjgl.demo.game.VoxelGameGL$$Lambda$43/0x00000008000c5040.run(Unknown Source)
	at java.lang.Thread.run([email protected]/Thread.java:829)
[1]    1807 abort      ~/Library/Java/JavaVirtualMachines/corretto-11.0.10/Contents/Home/bin/java

If I try a different demo then I get a different error:

$ ~/Library/Java/JavaVirtualMachines/corretto-11.0.10/Contents/Home/bin/java -XstartOnFirstThread  -cp target/lwjgl3-demos.jar org.lwjgl.demo.opengl.UniformArrayDemo

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:199)
	at org.lwjgl.demo.opengl.UniformArrayDemo.createRasterProgram(UniformArrayDemo.java:211)
	at org.lwjgl.demo.opengl.UniformArrayDemo.init(UniformArrayDemo.java:140)
	at org.lwjgl.demo.opengl.UniformArrayDemo.run(UniformArrayDemo.java:269)
	at org.lwjgl.demo.opengl.UniformArrayDemo.main(UniformArrayDemo.java:286)

I'm not sure what's going wrong here.

does not start on Linux

git commit: 1844a59

java:
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)

msgs from systemd logs in file.

msgs from console:
############################
Press W/S to move forward/backward
Press L.Ctrl/Spacebar to move down/up
Press A/D to strafe left/right
Press Q/E to roll left/right
Hold the left mouse button to shoot
Hold the right mouse button to rotate towards the mouse cursor
[LWJGL] OpenGL debug message
ID: 0x8
Source: SHADER COMPILER
Type: OTHER
Severity: NOTIFICATION
Message: FS SIMD8 shader: 10 inst, 0 loops, 820 cycles, 0:0 spills:fills, 2 sends, scheduled with mode top-down, Promoted 0 constants, compacted 160 to 144 bytes.
[LWJGL] OpenGL debug message
ID: 0x9
Source: SHADER COMPILER
Type: OTHER
Severity: NOTIFICATION
Message: FS SIMD16 shader: 13 inst, 0 loops, 836 cycles, 0:0 spills:fills, 2 sends, scheduled with mode top-down, Promoted 0 constants, compacted 208 to 192 bytes.
FATAL ERROR in native method: Thread[main,5,main]: No context is current or a function that is not available in the current context was called. The JVM will abort execution.
at org.lwjgl.opengl.GL11.glEnableClientState(Native Method)
at org.lwjgl.demo.game.SpaceGame.init(SpaceGame.java:330)
at org.lwjgl.demo.game.SpaceGame.run(SpaceGame.java:1037)
at org.lwjgl.demo.game.SpaceGame.main(SpaceGame.java:1057)
############################

LOGGGGG.txt

Build issue

Cloned the repo, ran "mvnw package" as indicated in readme, following error produced. Seems to be having issues finding the opengl, par, bgfx and vma natives listed in the pom.xml.

[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< org.lwjgl:lwjgl3-demos >-----------------------
[INFO] Building lwjgl3-demos 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.785 s
[INFO] Finished at: 2019-10-03T12:02:50-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project lwjgl3-demos: Could not resolve dependencies for project org.lwjgl:lwjgl3-demos:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.lwjgl:lwjgl-opengl:jar:natives-windows:3.2.4-SNAPSHOT, org.lwjgl:lwjgl-par:jar:natives-windows:3.2.4-SNAPSHOT, org.lwjgl:lwjgl-bgfx:jar:natives-windows:3.2.4-SNAPSHOT, org.lwjgl:lwjgl-vma:jar:natives-windows:3.2.4-SNAPSHOT, org.lwjgl:lwjgl-shaderc:jar:natives-windows:3.2.4-SNAPSHOT: Failure to find org.lwjgl:lwjgl-opengl:jar:natives-windows:3.2.4-20190903.201424-1 in https://oss.sonatype.org/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of oss.sonatype.org has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

SpaceGame demo Camera angular acceleration is way too high

Currently, rotating the camera via the exposed controls results in the camera spinning very fast before slowing down. The issue is visible when pressing either the Q or E button, or by dragging the mouse with the right mouse button pressed.

I'm quite sure that is not intended. However, I could not find the change that "broke" it upon taking a quick glance at the files history.

(A video showcasing the current behavior can be found here: https://youtu.be/fhPqu4c41u0).

Build fails, Stdio package.

When I clone the repo and run mvn clean install the build fails with the following error. Removing the lines referencing the Stdio class allows the build to continue.

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building lwjgl3-demos 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ lwjgl3-demos ---
[INFO] Deleting /home/jpfeltracco/repos/lwjgl3-demos/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ lwjgl3-demos ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 155 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ lwjgl3-demos ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 70 source files to /home/jpfeltracco/repos/lwjgl3-demos/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/jpfeltracco/repos/lwjgl3-demos/src/org/lwjgl/demo/bgfx/Demo.java:[11,29] cannot find symbol
symbol: class Stdio
location: package org.lwjgl.system.libc
[ERROR] /home/jpfeltracco/repos/lwjgl3-demos/src/org/lwjgl/demo/bgfx/Demo.java:[274,62] cannot find symbol
symbol: variable Stdio
location: class org.lwjgl.demo.bgfx.Demo
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.919 s
[INFO] Finished at: 2016-11-30T15:39:01-05:00
[INFO] Final Memory: 17M/273M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project lwjgl3-demos: Compilation failure: Compilation failure:
[ERROR] /home/jpfeltracco/repos/lwjgl3-demos/src/org/lwjgl/demo/bgfx/Demo.java:[11,29] cannot find symbol
[ERROR] symbol: class Stdio
[ERROR] location: package org.lwjgl.system.libc
[ERROR] /home/jpfeltracco/repos/lwjgl3-demos/src/org/lwjgl/demo/bgfx/Demo.java:[274,62] cannot find symbol
[ERROR] symbol: variable Stdio
[ERROR] location: class org.lwjgl.demo.bgfx.Demo
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

all demo code should be standalone from any other library and not requiring maven

eclipse simple java project without any other setup tasks, including maven project setup should not be required.
making the source files compatible with an IDE directly, and not using a script compilation file would be more useful for code exploration. Also any possible dependency to external libraries other than the lwjgl3 library should be removed.

k.i.s.s., just imho. the joml package dependency is not in the repository.

Some examples do not work

When I try to run some examples (AtomicDemo, for example), I get exceptions like

Message: 0:0(0): error: Compute shaders require GLSL 4.30 or GLSL ES 3.10 

I managed to fix this issues myself with some trivial changes to the code, but I wonder, why am I getting such errors, is it a problem with my setup, or demo code needs some maintenance? I am running ubuntu 22 and use Intel uhd graphics for 10'th gen.

Missing license

Hi,

I don't know how other people start with lwjgl3 but I certainly start with copy paste from some boilerplate (namely this repository :D)

So far I am assuming something like BSD/Unlicense/Apache but please make it clear by putting a license in the repo.

Vulkan ClearScreenDemo requires discrete gpu

I can run all Vulkan demos except the NvRayTracing (expected, right?) and ClearScreenDemo. I am on a mobile Intel GPU. I can modify the demo lines 232-233 and get rid of the part requiring VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, and the demo then works fine. The two NvRayTracing demos also have lines requiring VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, and none of the other demos have that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.