kotlin - 使用 stbi_load 加载图像失败(使用了 lwjgl)
问题描述
我正在按照这个视频学习 OpenGL。虽然它基于 C++,但我尝试将 Kotlin 与 lwjgl 一起使用。当我编码并运行它时:
// Something above
stbi_set_flip_vertically_on_load(true)
val width = IntBuffer.allocate(1)
val height = IntBuffer.allocate(1)
val colorChannel = IntBuffer.allocate(1)
val imageBuffer = stbi_load(
"src/main/resources/$filePath",
width, height,
colorChannel, 0
) ?: throw NoSuchElementException(filePath)
// Something below
它在 JVM 外部爆炸stbi_load()
并显示以下错误消息:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff98391456e, pid=3740, tid=0x0000000000004e94
#
# JRE version: OpenJDK Runtime Environment (8.0_302-b08) (build 1.8.0_302-b08)
# Java VM: OpenJDK 64-Bit Server VM (25.302-b08 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [lwjgl_stb.dll+0x456e]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# https://github.com/corretto/corretto-8/issues/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- T H R E A D ---------------
Current thread (0x000001f98ec0c000): JavaThread "main" [_thread_in_native, id=20116, stack(0x000000b726100000,0x000000b726200000)]
siginfo: ExceptionCode=0xc0000005, writing address 0x0000000000000000
Registers:
RAX=0x0000000000000200, RBX=0x000000b7261fed00, RCX=0x000000b7261fec90, RDX=0x000001f98ebc0000
RSP=0x000000b7261febb0, RBP=0x0000000000000000, RSI=0x0000000000000000, RDI=0x000001f9b823d040
R8 =0x000000b7261fd438, R9 =0x0000000000000001, R10=0x0000000000000000, R11=0x000000b7261fd650
R12=0x0000000000000000, R13=0x0000000000000001, R14=0x0000000000000000, R15=0x0000000000000000
RIP=0x00007ff98391456e, EFLAGS=0x0000000000010246
Top of Stack: (sp=0x000000b7261febb0)
0x000000b7261febb0: 000001f9b6031d00 000000b700000000
0x000000b7261febc0: 0000000000000000 0000000000000000
0x000000b7261febd0: 000000b7261fed38 00007ff983953854
0x000000b7261febe0: 000001f9b602e730 ffffffffffffffff
0x000000b7261febf0: 000000b7261fed00 0000000000000000
0x000000b7261fec00: 0000000000000000 000001f9b823d040
0x000000b7261fec10: 0000000000000008 000000b7261fed38
0x000000b7261fec20: 0000000000000000 0000000000000000
0x000000b7261fec30: 0000000000000000 0000000000000000
0x000000b7261fec40: 0000000000000000 00007ff983914a9c
0x000000b7261fec50: 000001f900000000 000001f9b602e730
0x000000b7261fec60: 0000000000000000 0000000000000000
0x000000b7261fec70: 000001f900000000 000000b7261fec90
0x000000b7261fec80: 000001f900000008 00007ff9839539b8
0x000000b7261fec90: 0000000000000008 0000000000000000
0x000000b7261feca0: 000001f98ec0c000 000000b7261fef00
Instructions: (pc=0x00007ff98391456e)
0x00007ff98391454e: 24 20 48 8b cf 75 07 e8 26 0d 00 00 eb 05 e8 9f
0x00007ff98391455e: 11 00 00 89 6b 0c 48 8b f8 48 85 c0 74 56 8b 03
0x00007ff98391456e: 41 89 04 24 8b 43 04 41 89 07 4d 85 f6 74 0d 8b
0x00007ff98391457e: 43 08 41 89 06 eb 05 48 8b 74 24 58 48 8b ce ff
Register to memory mapping:
RAX=0x0000000000000200 is an unknown value
RBX=0x000000b7261fed00 is pointing into the stack for thread: 0x000001f98ec0c000
RCX=0x000000b7261fec90 is pointing into the stack for thread: 0x000001f98ec0c000
RDX=0x000001f98ebc0000 is an unknown value
RSP=0x000000b7261febb0 is pointing into the stack for thread: 0x000001f98ec0c000
RBP=0x0000000000000000 is an unknown value
RSI=0x0000000000000000 is an unknown value
RDI=0x000001f9b823d040 is an unknown value
R8 =0x000000b7261fd438 is pointing into the stack for thread: 0x000001f98ec0c000
R9 =0x0000000000000001 is an unknown value
R10=0x0000000000000000 is an unknown value
R11=0x000000b7261fd650 is pointing into the stack for thread: 0x000001f98ec0c000
R12=0x0000000000000000 is an unknown value
R13=0x0000000000000001 is an unknown value
R14=0x0000000000000000 is an unknown value
R15=0x0000000000000000 is an unknown value
Stack: [0x000000b726100000,0x000000b726200000], sp=0x000000b7261febb0, free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.lwjgl.stb.STBImage.nstbi_load(JJJJI)J+0
j org.lwjgl.stb.STBImage.stbi_load(Ljava/lang/CharSequence;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;I)Ljava/nio/ByteBuffer;+64
j net.peanuuutz.graphics.Texture.<init>(Ljava/lang/String;IIII)V+67
j net.peanuuutz.graphics.TexturesKt.main()V+328
j net.peanuuutz.graphics.TexturesKt.main([Ljava/lang/String;)V+0
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x000001f9ac15a000 JavaThread "Service Thread" daemon [_thread_blocked, id=13668, stack(0x000000b727600000,0x000000b727700000)]
0x000001f9ac0c0000 JavaThread "C1 CompilerThread3" daemon [_thread_blocked, id=16976, stack(0x000000b727500000,0x000000b727600000)]
0x000001f9ac0be000 JavaThread "C2 CompilerThread2" daemon [_thread_blocked, id=20156, stack(0x000000b727400000,0x000000b727500000)]
0x000001f9ac0b9800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=24508, stack(0x000000b727300000,0x000000b727400000)]
0x000001f9ac0b6800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=20268, stack(0x000000b727200000,0x000000b727300000)]
0x000001f9ac0b3000 JavaThread "Monitor Ctrl-Break" daemon [_thread_in_native, id=3656, stack(0x000000b727100000,0x000000b727200000)]
0x000001f9a9b9d000 JavaThread "Attach Listener" daemon [_thread_blocked, id=3060, stack(0x000000b727000000,0x000000b727100000)]
0x000001f9a9b9c800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=11092, stack(0x000000b726f00000,0x000000b727000000)]
0x000001f9a9b67000 JavaThread "Finalizer" daemon [_thread_blocked, id=14844, stack(0x000000b726e00000,0x000000b726f00000)]
0x000001f9a9b60800 JavaThread "Reference Handler" daemon [_thread_blocked, id=23064, stack(0x000000b726d00000,0x000000b726e00000)]
=>0x000001f98ec0c000 JavaThread "main" [_thread_in_native, id=20116, stack(0x000000b726100000,0x000000b726200000)]
Other Threads:
0x000001f9a9b39000 VMThread [stack: 0x000000b726c00000,0x000000b726d00000] [id=7040]
0x000001f9ac15e000 WatcherThread [stack: 0x000000b727700000,0x000000b727800000] [id=11348]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
heap address: 0x00000006c2600000, size: 4058 MB, Compressed Oops mode: Zero based, Oop shift amount: 3
Narrow klass base: 0x0000000000000000, Narrow klass shift: 3
Compressed class space size: 1073741824 Address: 0x00000007c0000000
Heap:
PSYoungGen total 75776K, used 23537K [0x000000076b780000, 0x0000000770c00000, 0x00000007c0000000)
eden space 65024K, 36% used [0x000000076b780000,0x000000076ce7c680,0x000000076f700000)
from space 10752K, 0% used [0x0000000770180000,0x0000000770180000,0x0000000770c00000)
to space 10752K, 0% used [0x000000076f700000,0x000000076f700000,0x0000000770180000)
ParOldGen total 173568K, used 0K [0x00000006c2600000, 0x00000006ccf80000, 0x000000076b780000)
object space 173568K, 0% used [0x00000006c2600000,0x00000006c2600000,0x00000006ccf80000)
Metaspace used 9236K, capacity 9501K, committed 9600K, reserved 1058816K
class space used 786K, capacity 879K, committed 896K, reserved 1048576K
Card table byte_map: [0x000001f99fc60000,0x000001f9a0450000] byte_map_base: 0x000001f99c64d000
Marking Bits: (ParMarkBitMap*) 0x0000000051011820
Begin Bits: [0x000001f9a09a0000, 0x000001f9a4908000)
End Bits: [0x000001f9a4908000, 0x000001f9a8870000)
Polling page: 0x000001f98eb80000
CodeCache: size=245760Kb used=2896Kb max_used=2896Kb free=242864Kb
bounds [0x000001f9908a0000, 0x000001f990b80000, 0x000001f99f8a0000]
total_blobs=1554 nmethods=665 adapters=802
compilation: enabled
Compilation events (10 events):
Event: 0.513 Thread 0x000001f9ac0c0000 661 3 java.lang.Thread::isInterrupted (6 bytes)
Event: 0.513 Thread 0x000001f9ac0c0000 nmethod 661 0x000001f990b70e10 code [0x000001f990b70f80, 0x000001f990b71110]
Event: 0.513 Thread 0x000001f9ac0c0000 662 3 sun.nio.ch.Util$BufferCache::get (164 bytes)
Event: 0.514 Thread 0x000001f9ac0c0000 nmethod 662 0x000001f990b71190 code [0x000001f990b71380, 0x000001f990b71ed0]
Event: 0.514 Thread 0x000001f9ac0c0000 663 3 sun.nio.ch.FileDispatcherImpl::read (8 bytes)
Event: 0.514 Thread 0x000001f9ac0c0000 nmethod 663 0x000001f990b72390 code [0x000001f990b72500, 0x000001f990b72690]
Event: 0.514 Thread 0x000001f9ac0c0000 665 3 java.util.WeakHashMap::put (162 bytes)
Event: 0.514 Thread 0x000001f9ac0c0000 nmethod 665 0x000001f990b72750 code [0x000001f990b72980, 0x000001f990b73820]
Event: 0.514 Thread 0x000001f9ac0c0000 664 ! 3 sun.nio.ch.ChannelInputStream::read (95 bytes)
Event: 0.515 Thread 0x000001f9ac0c0000 nmethod 664 0x000001f990b73e50 code [0x000001f990b74040, 0x000001f990b74af0]
GC Heap History (0 events):
No events
Deoptimization events (2 events):
Event: 0.166 Thread 0x000001f98ec0c000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x000001f9909b55cc method=java.lang.String.equals(Ljava/lang/Object;)Z @ 8
Event: 0.192 Thread 0x000001f98ec0c000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x000001f990a362fc method=java.lang.String.indexOf([CII[CIII)I @ 3
Classes redefined (0 events):
No events
Internal exceptions (10 events):
Event: 0.235 Thread 0x000001f98ec0c000 Exception <a 'java/security/PrivilegedActionException'> (0x000000076c26b4a8) thrown at [C:\wsjdk\Corretto8Src\installers\windows\zip\corretto-build\buildRoot\src\hotspot\src\share\vm\prims\jvm.cpp, line 1523]
Event: 0.235 Thread 0x000001f98ec0c000 Exception <a 'java/security/PrivilegedActionException'> (0x000000076c26b8a0) thrown at [C:\wsjdk\Corretto8Src\installers\windows\zip\corretto-build\buildRoot\src\hotspot\src\share\vm\prims\jvm.cpp, line 1523]
Event: 0.235 Thread 0x000001f98ec0c000 Exception <a 'java/security/PrivilegedActionException'> (0x000000076c26d940) thrown at [C:\wsjdk\Corretto8Src\installers\windows\zip\corretto-build\buildRoot\src\hotspot\src\share\vm\prims\jvm.cpp, line 1523]
Event: 0.235 Thread 0x000001f98ec0c000 Exception <a 'java/security/PrivilegedActionException'> (0x000000076c26dd38) thrown at [C:\wsjdk\Corretto8Src\installers\windows\zip\corretto-build\buildRoot\src\hotspot\src\share\vm\prims\jvm.cpp, line 1523]
Event: 0.235 Thread 0x000001f98ec0c000 Exception <a 'java/security/PrivilegedActionException'> (0x000000076c26fdd8) thrown at [C:\wsjdk\Corretto8Src\installers\windows\zip\corretto-build\buildRoot\src\hotspot\src\share\vm\prims\jvm.cpp, line 1523]
Event: 0.235 Thread 0x000001f98ec0c000 Exception <a 'java/security/PrivilegedActionException'> (0x000000076c2701d0) thrown at [C:\wsjdk\Corretto8Src\installers\windows\zip\corretto-build\buildRoot\src\hotspot\src\share\vm\prims\jvm.cpp, line 1523]
Event: 0.235 Thread 0x000001f98ec0c000 Exception <a 'java/security/PrivilegedActionException'> (0x000000076c272198) thrown at [C:\wsjdk\Corretto8Src\installers\windows\zip\corretto-build\buildRoot\src\hotspot\src\share\vm\prims\jvm.cpp, line 1523]
Event: 0.235 Thread 0x000001f98ec0c000 Exception <a 'java/security/PrivilegedActionException'> (0x000000076c272590) thrown at [C:\wsjdk\Corretto8Src\installers\windows\zip\corretto-build\buildRoot\src\hotspot\src\share\vm\prims\jvm.cpp, line 1523]
Event: 0.334 Thread 0x000001f98ec0c000 Exception <a 'sun/nio/fs/WindowsException'> (0x000000076c325c70) thrown at [C:\wsjdk\Corretto8Src\installers\windows\zip\corretto-build\buildRoot\src\hotspot\src\share\vm\prims\jni.cpp, line 711]
Event: 0.334 Thread 0x000001f98ec0c000 Exception <a 'sun/nio/fs/WindowsException'> (0x000000076c3276b0) thrown at [C:\wsjdk\Corretto8Src\installers\windows\zip\corretto-build\buildRoot\src\hotspot\src\share\vm\prims\jni.cpp, line 711]
Events (10 events):
Event: 0.507 loading class org/lwjgl/opengl/GL$ICDStatic$WriteOnce
Event: 0.507 loading class org/lwjgl/opengl/GL$ICDStatic$WriteOnce done
Event: 0.507 loading class net/peanuuutz/graphics/Texture
Event: 0.507 loading class net/peanuuutz/graphics/Texture done
Event: 0.507 loading class org/lwjgl/stb/STBImage
Event: 0.507 loading class org/lwjgl/stb/STBImage done
Event: 0.508 loading class org/lwjgl/stb/LibSTB
Event: 0.508 loading class org/lwjgl/stb/LibSTB done
Event: 0.516 loading class java/nio/HeapIntBuffer
Event: 0.516 loading class java/nio/HeapIntBuffer done
Dynamic libraries:
0x00007ff6c0390000 - 0x00007ff6c03ca000 C:\Users\<User>\.jdks\corretto-1.8.0_302\bin\java.exe
0x00007ff9bc240000 - 0x00007ff9bc430000 C:\windows\SYSTEM32\ntdll.dll
0x00007ff9bbe70000 - 0x00007ff9bbf22000 C:\windows\System32\KERNEL32.DLL
0x00007ff9b9660000 - 0x00007ff9b9903000 C:\windows\System32\KERNELBASE.dll
0x00007ff9baee0000 - 0x00007ff9baf83000 C:\windows\System32\ADVAPI32.dll
0x00007ff9bab50000 - 0x00007ff9babee000 C:\windows\System32\msvcrt.dll
0x00007ff9ba5e0000 - 0x00007ff9ba677000 C:\windows\System32\sechost.dll
0x00007ff9baf90000 - 0x00007ff9bb0b0000 C:\windows\System32\RPCRT4.dll
0x00007ff9bbf30000 - 0x00007ff9bc0c4000 C:\windows\System32\USER32.dll
0x00007ff9ba2c0000 - 0x00007ff9ba2e1000 C:\windows\System32\win32u.dll
0x00007ff9bb130000 - 0x00007ff9bb156000 C:\windows\System32\GDI32.dll
0x00007ff9b9450000 - 0x00007ff9b95e4000 C:\windows\System32\gdi32full.dll
0x00007ff9b92b0000 - 0x00007ff9b934e000 C:\windows\System32\msvcp_win.dll
0x00007ff9b9350000 - 0x00007ff9b944a000 C:\windows\System32\ucrtbase.dll
0x00007ff9a7010000 - 0x00007ff9a7295000 C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.18362.657_none_e6c5b579130e3898\COMCTL32.dll
0x00007ff9bb8c0000 - 0x00007ff9bbbf6000 C:\windows\System32\combase.dll
0x00007ff9b9230000 - 0x00007ff9b92b0000 C:\windows\System32\bcryptPrimitives.dll
0x00007ff9badd0000 - 0x00007ff9badfe000 C:\windows\System32\IMM32.DLL
0x00007ff97c2b0000 - 0x00007ff97c39f000 C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\bin\msvcr120.dll
0x00007ff997140000 - 0x00007ff9971e6000 C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\bin\msvcp120.dll
0x0000000050820000 - 0x0000000051090000 C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\bin\server\jvm.dll
0x00007ff9bb0b0000 - 0x00007ff9bb0b8000 C:\windows\System32\PSAPI.DLL
0x00007ff9b36d0000 - 0x00007ff9b36da000 C:\windows\SYSTEM32\VERSION.dll
0x00007ff9b5a80000 - 0x00007ff9b5a89000 C:\windows\SYSTEM32\WSOCK32.dll
0x00007ff9aaac0000 - 0x00007ff9aaae4000 C:\windows\SYSTEM32\WINMM.dll
0x00007ff9bb0c0000 - 0x00007ff9bb12f000 C:\windows\System32\WS2_32.dll
0x00007ff9ab070000 - 0x00007ff9ab09d000 C:\windows\SYSTEM32\winmmbase.dll
0x00007ff9b95f0000 - 0x00007ff9b963a000 C:\windows\System32\cfgmgr32.dll
0x00007ff9b4cd0000 - 0x00007ff9b4cdf000 C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\bin\verify.dll
0x00007ff99cc00000 - 0x00007ff99cc29000 C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\bin\java.dll
0x00007ff99b8c0000 - 0x00007ff99b8ea000 C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\bin\instrument.dll
0x00007ff9a8a50000 - 0x00007ff9a8a66000 C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\bin\zip.dll
0x00007ff9bb1d0000 - 0x00007ff9bb8b5000 C:\windows\System32\SHELL32.dll
0x00007ff9bae10000 - 0x00007ff9baeb9000 C:\windows\System32\shcore.dll
0x00007ff9b99f0000 - 0x00007ff9ba16f000 C:\windows\System32\windows.storage.dll
0x00007ff9b9120000 - 0x00007ff9b913f000 C:\windows\System32\profapi.dll
0x00007ff9b9180000 - 0x00007ff9b91ca000 C:\windows\System32\powrprof.dll
0x00007ff9b9110000 - 0x00007ff9b9120000 C:\windows\System32\UMPDC.dll
0x00007ff9ba680000 - 0x00007ff9ba6d2000 C:\windows\System32\shlwapi.dll
0x00007ff9b9160000 - 0x00007ff9b9171000 C:\windows\System32\kernel.appcore.dll
0x00007ff9b9640000 - 0x00007ff9b9657000 C:\windows\System32\cryptsp.dll
0x00007ff99cc70000 - 0x00007ff99cc8a000 D:\IntelliJ IDEA 2021.1.1\bin\breakgen64.dll
0x00007ff9a7ef0000 - 0x00007ff9a7f0a000 C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\bin\net.dll
0x00007ff9ac1f0000 - 0x00007ff9ac210000 C:\windows\system32\PrxerDrv.dll
0x00007ff9b8980000 - 0x00007ff9b89e7000 C:\windows\system32\mswsock.dll
0x00007ff9a4930000 - 0x00007ff9a4942000 C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\bin\nio.dll
0x00007ff985d30000 - 0x00007ff985da2000 C:\Users\<User>\AppData\Local\Temp\lwjgl<User>\3.2.2-build-10\lwjgl.dll
0x00007ff987630000 - 0x00007ff98768e000 C:\Users\<User>\AppData\Local\Temp\lwjgl<User>\3.2.2-build-10\glfw.dll
0x00007ff9b7100000 - 0x00007ff9b7199000 C:\windows\system32\uxtheme.dll
0x00007ff995400000 - 0x00007ff995443000 C:\windows\SYSTEM32\dinput8.dll
0x00007ff99b530000 - 0x00007ff99b541000 C:\windows\SYSTEM32\xinput1_4.dll
0x00007ff9b8f10000 - 0x00007ff9b8f3a000 C:\windows\SYSTEM32\DEVOBJ.dll
0x00007ff9b7520000 - 0x00007ff9b754d000 C:\windows\SYSTEM32\dwmapi.dll
0x00007ff99b700000 - 0x00007ff99b81a000 C:\windows\SYSTEM32\inputhost.dll
0x00007ff9b55e0000 - 0x00007ff9b56cf000 C:\windows\SYSTEM32\PROPSYS.dll
0x00007ff9b6df0000 - 0x00007ff9b6ec4000 C:\windows\SYSTEM32\CoreMessaging.dll
0x00007ff9a4240000 - 0x00007ff9a456a000 C:\windows\SYSTEM32\CoreUIComponents.dll
0x00007ff9b4b70000 - 0x00007ff9b4cc3000 C:\windows\SYSTEM32\wintypes.dll
0x00007ff9bbda0000 - 0x00007ff9bbe64000 C:\windows\System32\OLEAUT32.dll
0x00007ff9b8170000 - 0x00007ff9b81a1000 C:\windows\SYSTEM32\ntmarta.dll
0x00007ff9ba4a0000 - 0x00007ff9ba5d5000 C:\windows\System32\MSCTF.dll
0x00007ff9b7d20000 - 0x00007ff9b7d2e000 C:\windows\SYSTEM32\HID.DLL
0x00007ff9ba6e0000 - 0x00007ff9bab50000 C:\windows\System32\SETUPAPI.DLL
0x00007ff9b99c0000 - 0x00007ff9b99e6000 C:\windows\System32\bcrypt.dll
0x00007ff9b91d0000 - 0x00007ff9b922c000 C:\windows\System32\WINTRUST.dll
0x00007ff9b9140000 - 0x00007ff9b9152000 C:\windows\System32\MSASN1.dll
0x00007ff9ba170000 - 0x00007ff9ba2b9000 C:\windows\System32\CRYPT32.dll
0x00007ff99a6e0000 - 0x00007ff99a836000 C:\windows\SYSTEM32\opengl32.dll
0x00007ff9acfd0000 - 0x00007ff9acffc000 C:\windows\SYSTEM32\GLU32.dll
0x00007ff9b7df0000 - 0x00007ff9b7e10000 C:\windows\SYSTEM32\dxcore.dll
0x00007ff96e170000 - 0x00007ff96f020000 C:\windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_d9c21d7d43c1adb3\ig9icd64.dll
0x00007ff9b7e10000 - 0x00007ff9b7efb000 C:\windows\system32\dxgi.dll
0x00007ff99f200000 - 0x00007ff9a11c8000 C:\windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_d9c21d7d43c1adb3\igc64.dll
0x00007ff9a1280000 - 0x00007ff9a139a000 C:\windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_d9c21d7d43c1adb3\igdgmm64.dll
0x00007ff99ccd0000 - 0x00007ff99cd6e000 C:\windows\System32\TextInputFramework.dll
0x00007ff9ac3e0000 - 0x00007ff9ac686000 C:\windows\System32\iertutil.dll
0x00007ff986790000 - 0x00007ff9867e8000 C:\Users\<User>\AppData\Local\Temp\lwjgl<User>\3.2.2-build-10\lwjgl_opengl.dll
0x00007ff983910000 - 0x00007ff98398f000 C:\Users\<User>\AppData\Local\Temp\lwjgl<User>\3.2.2-build-10\lwjgl_stb.dll
0x00007ff9b7a40000 - 0x00007ff9b7c34000 C:\windows\SYSTEM32\dbghelp.dll
VM Arguments:
jvm_args: -javaagent:D:\IntelliJ IDEA 2021.1.1\lib\idea_rt.jar=58472:D:\IntelliJ IDEA 2021.1.1\bin -Dfile.encoding=UTF-8
java_command: net.peanuuutz.graphics.TexturesKt
java_class_path (initial): C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\charsets.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\ext\access-bridge-64.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\ext\cldrdata.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\ext\dnsns.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\ext\jaccess.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\ext\jfxrt.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\ext\localedata.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\ext\nashorn.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\ext\sunec.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\ext\sunjce_provider.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\ext\sunmscapi.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\ext\sunpkcs11.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\ext\zipfs.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\jce.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\jfr.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\jfxswt.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\jsse.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\management-agent.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\resources.jar;C:\Users\<User>\.jdks\corretto-1.8.0_302\jre\lib\rt.jar;E:\Everyday\Amateur\CS\Kotlin\Exercises\Graphics\build\classes\kotlin\test;E:\Everyday\Amateur\CS\Kotlin\Exercises\Graphics\build\classes\kotlin\main;E:\Everyday\Amateur\CS\Kotlin\Exercises\Graphics\build\resources\main;D:\Cache\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib\1.4.32\461367948840adbb0839c51d91ed74ef4a9ccb52\kotlin-stdlib-1.4.32.jar;D:\Cache\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-assimp\3.2.2\d4128312444099cea3c4dbb77f5098d19e340d\lwjgl-assimp-3.2.2.jar;D:\Cache\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-glfw\3.2.2\d3ad4df38e400b8afba1de63f84338809399df5b\lwjgl-glfw-3.2.2.jar;D:\Cache\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-openal\3.2.
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk-11.0.12
PATH=C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;D:\Python\Python39\Scripts\;D:\Python\Python39\;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\compiler;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;E:\Minecraft\´´×÷\µØͼ\¹¤¾ß\WorldPainter;C:\Program Files\Java\jdk-11.0.12\bin;D:\Git\cmd;D:\MySQL\bin;D:\gradle-6.8.3\bin;C:\Program Files\nodejs\;E:\Minecraft\Replay\.minecraft\FFmpeg\bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;E:\Minecraft\´´×÷\µØͼ\¹¤¾ß\WorldPainter;E:\Minecraft\Replay\.minecraft\FFmpeg\bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;E:\Minecraft\´´×÷\µØͼ\¹¤¾ß\WorldPainter;E:\Minecraft\Replay\.minecraft\FFmpeg\bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\window;D:\Visual Studio Code\Microsoft VS Code\bin;D:\PyCharm 2020.3\bin;;C:\Users\<User>\AppData\Roaming\npm;D:\Fiddler
USERNAME=<User>
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 13, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows 10.0 , 64 bit Build 18362 (10.0.18362.329)
CPU:total 12 (initial active 12) (6 cores per cpu, 2 threads per core) family 6 model 158 stepping 13, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx
Memory: 4k page, physical 16614584k(6470396k free), swap 25527480k(11553304k free)
vm_info: OpenJDK 64-Bit Server VM (25.302-b08) for windows-amd64 JRE (1.8.0_302-b08), built on Jul 15 2021 19:37:21 by "Administrator" with MS VC++ 12.0 (VS2013)
time: Thu Oct 07 16:20:51 2021
timezone: ?D1¨²¡À¨º¡Á?¨º¡À??
elapsed time: 0.532927 seconds (0d 0h 0m 0s)
图片在这里(png,512px),我已经将它保存在(可能)正确的位置,如代码所示。
那么原生环境中发生了什么?:(
解决方案
LWJGL 3在与像 stb_image 这样的本机库通信时不支持堆上(即非直接)NIO 缓冲区。非直接/堆上 NIO 缓冲区是 Java 字节数组的包装器。
使用 LWJGL 3,您总是需要使用堆外(即直接)NIO 缓冲区。
有关差异的进一步说明,请参阅https://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html#direct。
所以,而不是
IntBuffer.allocate(1)
你应该使用:
ByteBuffer.allocateDirect(4).asIntBuffer()
此外,您应该配置 NIO 缓冲区以使用与您的平台相同的字节序,否则您将在以后从缓冲区中读取垃圾(所有 NIO 缓冲区的默认字节序是网络字节顺序,即大字节序):
ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer()
并且由于上面的内容非常丰富,LWJGL 3 提供了一个BufferUtils
带有简单包装器的类,例如:
BufferUtils.createIntBuffer(1)
达到与上述相同的目的。
最后但并非最不重要的一点是,在 LWJGL 3 中进行正确和高效的内存管理更加复杂,因为在这种特殊情况下,您最好使用MemoryStack
. 见:https ://blog.lwjgl.org/memory-management-in-lwjgl-3/
推荐阅读
- python - 从 Word 中分离数字并在 Python 中返回新列表
- javascript - 以 rails 形式包含自定义参数
- java - 使用服务帐户在 google drive sdk 中列出 teamdrive
- python - 如何检查一个numpy数组的所有元素是否在另一个numpy数组中
- replace - 如何用 ABCD 代替 ABC 而不是用 ABCDD 代替 ABCD
- google-bigquery - 如何在 bq 命令行中的 where 条件下传递动态参数
- c# - OpenFileDialog 可以按名称过滤掉某些文件吗?
- javascript - 产生外部进程的简单方法
- wildfly - 代理/负载均衡器后面的 WildFly 访问控制列表
- dependencies - 基于先前运行的气流任务