gpt4 book ai didi

java - LWJGL glCreateBuffers 导致问题

转载 作者:行者123 更新时间:2023-12-02 12:14:58 26 4
gpt4 key购买 nike

所以我是 OpenGL 新手,我一直在关注一些关于如何绘制简单三角形的教程。我在这里不使用着色器,尽管我知道如何使用它们。教程说使用 glCreateBuffers 创建缓冲区,但我在代码中更改的所有内容都无法防止该错误。我一直在关注 OpenGL 编程指南,并观看了几个有关该主题的 YouTube 视频。我还为我的显卡更新了最新的 NVIDIA 驱动程序。我做错了什么?

错误,其中还包含所有硬件规范:

#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007fffa120235d, pid=4592, tid=0x00000000000035a8
#
# JRE version: Java(TM) SE Runtime Environment (8.0_101-b13) (build 1.8.0_101-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [lwjgl_opengl.dll+0x235d]
#
# 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:
# http://bugreport.java.com/bugreport/crash.jsp
# 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 (0x00000000032a9000): JavaThread "main" [_thread_in_native, id=13736, stack(0x0000000003160000,0x0000000003260000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x0000000000000830

Registers:
RAX=0x000000005619ed50, RBX=0x000000001a523d28, RCX=0x0000000000000001, RDX=0x000000001daa7d5c
RSP=0x000000000325f4f8, RBP=0x000000000325f580, RSI=0x0000000000000048, RDI=0x0000000003507e70
R8 =0x0000000000000001, R9 =0x000000001daa7d5c, R10=0x0000000000000000, R11=0x0000000055c2b4a0
R12=0x0000000000000000, R13=0x000000001a523d28, R14=0x000000000325f5b0, R15=0x00000000032a9000
RIP=0x00007fffa120235d, EFLAGS=0x0000000000010202

Top of Stack: (sp=0x000000000325f4f8)
0x000000000325f4f8: 0000000003517f54 0000000003507e70
0x000000000325f508: 0000000003517cbd 00000000032a9000
0x000000000325f518: 000000001a523d28 0000000000000048
0x000000000325f528: 00000000032a9000 000000000325f628
0x000000000325f538: 0000000003517c82 000000000325f540
0x000000000325f548: 000000001a523d28 000000000325f5b0
0x000000000325f558: 000000001a539f98 0000000000000000
0x000000000325f568: 000000001a523d28 0000000000000000
0x000000000325f578: 000000000325f5a0 000000000325f5f8
0x000000000325f588: 000000000350835d 00000007813fb2d8
0x000000000325f598: 00000000035119d8 000000001daa7d5c
0x000000000325f5a8: 0000000781481140 0000000000000001
0x000000000325f5b8: 000000000325f5b8 000000001a523e7c
0x000000000325f5c8: 000000000325f628 000000001a539f98
0x000000000325f5d8: 0000000000000000 000000001a523ee0
0x000000000325f5e8: 000000000325f5a0 000000000325f630

Instructions: (pc=0x00007fffa120235d)
0x00007fffa120233d: ff a2 28 17 00 00 cc cc cc cc cc cc cc cc cc cc
0x00007fffa120234d: cc cc cc 48 8b 01 49 8b d1 41 8b c8 4c 8b 50 18
0x00007fffa120235d: 49 ff a2 30 08 00 00 cc cc cc cc cc cc cc cc cc
0x00007fffa120236d: cc cc cc 40 53 48 8b 01 41 8b d8 4c 8b 44 24 30


Register to memory mapping:

RAX=0x000000005619ed50 is an unknown value
RBX={method} {0x000000001a523d30} 'nglCreateBuffers' '(IJ)V' in 'org/lwjgl/opengl/GL45'
RCX=0x0000000000000001 is an unknown value
RDX=0x000000001daa7d5c is an unknown value
RSP=0x000000000325f4f8 is pointing into the stack for thread: 0x00000000032a9000
RBP=0x000000000325f580 is pointing into the stack for thread: 0x00000000032a9000
RSI=0x0000000000000048 is an unknown value
RDI=0x0000000003507e70 is at code_begin+1040 in an Interpreter codelet
invoke return entry points [0x0000000003507a60, 0x0000000003508440] 2528 bytes
R8 =0x0000000000000001 is an unknown value
R9 =0x000000001daa7d5c is an unknown value
R10=0x0000000000000000 is an unknown value
R11=0x0000000055c2b4a0 is an unknown value
R12=0x0000000000000000 is an unknown value
R13={method} {0x000000001a523d30} 'nglCreateBuffers' '(IJ)V' in 'org/lwjgl/opengl/GL45'
R14=0x000000000325f5b0 is pointing into the stack for thread: 0x00000000032a9000
R15=0x00000000032a9000 is a thread


Stack: [0x0000000003160000,0x0000000003260000], sp=0x000000000325f4f8, free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [lwjgl_opengl.dll+0x235d]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.lwjgl.opengl.GL45.nglCreateBuffers(IJ)V+0
j org.lwjgl.opengl.GL45.glCreateBuffers()I+20
j com.meti.HelloTriangle.init()V+169
j com.meti.HelloTriangle.run()V+1
j com.meti.HelloTriangle.main([Ljava/lang/String;)V+7
v ~StubRoutines::call_stub

--------------- P R O C E S S ---------------

Java Threads: ( => current thread )
0x000000001cbaf000 JavaThread "Service Thread" daemon [_thread_blocked, id=15408, stack(0x000000001d6a0000,0x000000001d7a0000)]
0x000000001cbb6800 JavaThread "C1 CompilerThread3" daemon [_thread_blocked, id=4928, stack(0x000000001d5a0000,0x000000001d6a0000)]
0x000000001cbae000 JavaThread "C2 CompilerThread2" daemon [_thread_blocked, id=15648, stack(0x000000001d4a0000,0x000000001d5a0000)]
0x000000001cbb2800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=3528, stack(0x000000001d3a0000,0x000000001d4a0000)]
0x000000001cbad800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=2988, stack(0x000000001d2a0000,0x000000001d3a0000)]
0x000000001caf6000 JavaThread "Monitor Ctrl-Break" daemon [_thread_in_native, id=10828, stack(0x000000001d1a0000,0x000000001d2a0000)]
0x000000001c8e4800 JavaThread "Attach Listener" daemon [_thread_blocked, id=15864, stack(0x000000001d0a0000,0x000000001d1a0000)]
0x000000001c8e3000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=13440, stack(0x000000001cfa0000,0x000000001d0a0000)]
0x000000001a9e4000 JavaThread "Finalizer" daemon [_thread_blocked, id=15624, stack(0x000000001ccb0000,0x000000001cdb0000)]
0x000000000339e000 JavaThread "Reference Handler" daemon [_thread_blocked, id=13760, stack(0x000000001c7b0000,0x000000001c8b0000)]
=>0x00000000032a9000 JavaThread "main" [_thread_in_native, id=13736, stack(0x0000000003160000,0x0000000003260000)]

Other Threads:
0x000000001a9d9000 VMThread [stack: 0x000000001c6b0000,0x000000001c7b0000] [id=13368]
0x000000001cbc0000 WatcherThread [stack: 0x000000001dfa0000,0x000000001e0a0000] [id=13180]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap:
PSYoungGen total 57344K, used 11847K [0x0000000780900000, 0x0000000784900000, 0x00000007c0000000)
eden space 49152K, 24% used [0x0000000780900000,0x0000000781491f48,0x0000000783900000)
from space 8192K, 0% used [0x0000000784100000,0x0000000784100000,0x0000000784900000)
to space 8192K, 0% used [0x0000000783900000,0x0000000783900000,0x0000000784100000)
ParOldGen total 131072K, used 0K [0x0000000701a00000, 0x0000000709a00000, 0x0000000780900000)
object space 131072K, 0% used [0x0000000701a00000,0x0000000701a00000,0x0000000709a00000)
Metaspace used 6034K, capacity 6220K, committed 6400K, reserved 1056768K
class space used 655K, capacity 738K, committed 768K, reserved 1048576K

Card table byte_map: [0x00000000128c0000,0x0000000012ec0000] byte_map_base: 0x000000000f0b3000

Marking Bits: (ParMarkBitMap*) 0x000000005621a6d0
Begin Bits: [0x0000000013ac0000, 0x0000000016a58000)
End Bits: [0x0000000016a58000, 0x00000000199f0000)

Polling page: 0x0000000001300000

CodeCache: size=245760Kb used=2341Kb max_used=2353Kb free=243418Kb
bounds [0x0000000003500000, 0x0000000003770000, 0x0000000012500000]
total_blobs=1191 nmethods=469 adapters=635
compilation: enabled

Compilation events (10 events):
Event: 0.540 Thread 0x000000001cbb6800 465 3 java.util.zip.InflaterInputStream::read (32 bytes)
Event: 0.540 Thread 0x000000001cbb6800 nmethod 465 0x0000000003745dd0 code [0x0000000003745f60, 0x00000000037463d8]
Event: 0.541 Thread 0x000000001cbb6800 466 3 java.util.WeakHashMap::remove (133 bytes)
Event: 0.542 Thread 0x000000001cbb6800 nmethod 466 0x0000000003746590 code [0x0000000003746780, 0x0000000003747268]
Event: 0.545 Thread 0x000000001cbad800 nmethod 463 0x000000000374a6d0 code [0x000000000374a820, 0x000000000374ac38]
Event: 0.545 Thread 0x000000001cbb6800 467 3 sun.misc.JarIndex::get (49 bytes)
Event: 0.545 Thread 0x000000001cbb6800 nmethod 467 0x0000000003749950 code [0x0000000003749b20, 0x000000000374a398]
Event: 0.546 Thread 0x000000001cbae000 468 4 java.lang.String::indexOf (166 bytes)
Event: 0.546 Thread 0x000000001cbb6800 469 3 java.net.URL::toString (5 bytes)
Event: 0.546 Thread 0x000000001cbb6800 nmethod 469 0x0000000003749410 code [0x0000000003749580, 0x0000000003749868]

GC Heap History (0 events):
No events

Deoptimization events (1 events):
Event: 0.270 Thread 0x00000000032a9000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x000000000367a394 method=java.lang.String.indexOf([CII[CIII)I @ 134

Internal exceptions (10 events):
Event: 0.039 Thread 0x00000000032a9000 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.prefetchRead(Ljava/lang/Object;J)V name or signature does not match> (0x0000000780907fa8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\prims\��1����?
Event: 0.234 Thread 0x00000000032a9000 Exception <a 'java/lang/NoSuchMethodError': java.lang.Object.lambda$static$0(Ljava/lang/String;)Ljava/lang/Boolean;> (0x0000000780f3d758) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\linkResolver.:%�l��?
Event: 0.248 Thread 0x00000000032a9000 Exception <a 'java/lang/NoSuchFieldError': method resolution failed> (0x0000000780fbfba0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\prims\methodHandles.cpp, line 1146]
Event: 0.249 Thread 0x00000000032a9000 Exception <a 'java/lang/NoSuchFieldError': method resolution failed> (0x0000000780fcda48) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\prims\methodHandles.cpp, line 1146]
Event: 0.296 Thread 0x00000000032a9000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007811bcef8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\prims\jvm.cpp, line 1386]
Event: 0.296 Thread 0x00000000032a9000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007811bd108) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\prims\jvm.cpp, line 1386]
Event: 0.296 Thread 0x00000000032a9000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007811c11d8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\prims\jvm.cpp, line 1386]
Event: 0.296 Thread 0x00000000032a9000 Exception <a 'java/security/PrivilegedActionException'> (0x00000007811c13e8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\prims\jvm.cpp, line 1386]
Event: 0.543 Thread 0x00000000032a9000 Exception <a 'sun/nio/fs/WindowsException'> (0x0000000781462538) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 0.544 Thread 0x00000000032a9000 Exception <a 'sun/nio/fs/WindowsException'> (0x0000000781463f38) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\prims\jni.cpp, line 709]

Events (10 events):
Event: 0.544 loading class java/nio/file/NoSuchFileException
Event: 0.544 loading class java/nio/file/FileSystemException
Event: 0.544 loading class java/nio/file/FileSystemException done
Event: 0.544 loading class java/nio/file/NoSuchFileException done
Event: 0.544 loading class org/lwjgl/opengl/GL$1
Event: 0.544 loading class org/lwjgl/opengl/GL$1 done
Event: 0.545 loading class org/lwjgl/opengl/GL$SharedLibraryGL
Event: 0.545 loading class org/lwjgl/opengl/GL$SharedLibraryGL done
Event: 0.545 loading class org/lwjgl/system/SharedLibrary$Delegate
Event: 0.545 loading class org/lwjgl/system/SharedLibrary$Delegate done


Dynamic libraries:
0x00007ff63a440000 - 0x00007ff63a477000 C:\Program Files\Java\jdk1.8.0_101\bin\java.exe
0x00007fffbc000000 - 0x00007fffbc1db000 C:\WINDOWS\SYSTEM32\ntdll.dll
0x00007fffbb630000 - 0x00007fffbb6de000 C:\WINDOWS\System32\KERNEL32.DLL
0x00007fffb86c0000 - 0x00007fffb8909000 C:\WINDOWS\System32\KERNELBASE.dll
0x00007fffbabe0000 - 0x00007fffbac81000 C:\WINDOWS\System32\ADVAPI32.dll
0x00007fffbbf60000 - 0x00007fffbbffd000 C:\WINDOWS\System32\msvcrt.dll
0x00007fffbb6e0000 - 0x00007fffbb739000 C:\WINDOWS\System32\sechost.dll
0x00007fffbb8a0000 - 0x00007fffbb9c5000 C:\WINDOWS\System32\RPCRT4.dll
0x00007fffbb750000 - 0x00007fffbb89a000 C:\WINDOWS\System32\USER32.dll
0x00007fffb8970000 - 0x00007fffb898e000 C:\WINDOWS\System32\win32u.dll
0x00007fffbaa60000 - 0x00007fffbaa87000 C:\WINDOWS\System32\GDI32.dll
0x00007fffb93d0000 - 0x00007fffb9558000 C:\WINDOWS\System32\gdi32full.dll
0x00007fffb8620000 - 0x00007fffb86ba000 C:\WINDOWS\System32\msvcp_win.dll
0x00007fffb8520000 - 0x00007fffb8616000 C:\WINDOWS\System32\ucrtbase.dll
0x00007fffa8480000 - 0x00007fffa86e7000 C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.15063.483_none_26002d27e7c744a2\COMCTL32.dll
0x00007fffbba70000 - 0x00007fffbbd69000 C:\WINDOWS\System32\combase.dll
0x00007fffb8990000 - 0x00007fffb89fa000 C:\WINDOWS\System32\bcryptPrimitives.dll
0x00007fffbbd90000 - 0x00007fffbbdbd000 C:\WINDOWS\System32\IMM32.DLL
0x00000000562a0000 - 0x0000000056372000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\msvcr100.dll
0x0000000055a00000 - 0x000000005629a000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\server\jvm.dll
0x00007fffbb9d0000 - 0x00007fffbb9d8000 C:\WINDOWS\System32\PSAPI.DLL
0x00007fffb46f0000 - 0x00007fffb46f9000 C:\WINDOWS\SYSTEM32\WSOCK32.dll
0x00007fffb5410000 - 0x00007fffb5433000 C:\WINDOWS\SYSTEM32\WINMM.dll
0x00007fffbb360000 - 0x00007fffbb3cc000 C:\WINDOWS\System32\WS2_32.dll
0x00007fffabe10000 - 0x00007fffabe3b000 C:\WINDOWS\SYSTEM32\WINMMBASE.dll
0x00007fffad5f0000 - 0x00007fffad5fa000 C:\WINDOWS\SYSTEM32\VERSION.dll
0x00007fffb8a00000 - 0x00007fffb8a49000 C:\WINDOWS\System32\cfgmgr32.dll
0x0000000057380000 - 0x000000005738f000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\verify.dll
0x0000000057350000 - 0x0000000057379000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\java.dll
0x0000000057320000 - 0x0000000057343000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\instrument.dll
0x0000000057300000 - 0x0000000057316000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\zip.dll
0x00007fffb9620000 - 0x00007fffbaa56000 C:\WINDOWS\System32\SHELL32.dll
0x00007fffbaa90000 - 0x00007fffbab3a000 C:\WINDOWS\System32\shcore.dll
0x00007fffb8a50000 - 0x00007fffb9143000 C:\WINDOWS\System32\windows.storage.dll
0x00007fffbb190000 - 0x00007fffbb1e1000 C:\WINDOWS\System32\shlwapi.dll
0x00007fffb8490000 - 0x00007fffb84a1000 C:\WINDOWS\System32\kernel.appcore.dll
0x00007fffb84b0000 - 0x00007fffb84fc000 C:\WINDOWS\System32\powrprof.dll
0x00007fffb8470000 - 0x00007fffb8485000 C:\WINDOWS\System32\profapi.dll
0x00007fffabef0000 - 0x00007fffabf0a000 C:\Users\mathm\AppData\Local\JetBrains\Toolbox\apps\IDEA-C\ch-1\172.3968.16\bin\breakgen64.dll
0x00000000559e0000 - 0x00000000559fa000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\net.dll
0x00007fffb7d20000 - 0x00007fffb7d7c000 C:\WINDOWS\system32\mswsock.dll
0x00000000559c0000 - 0x00000000559d1000 C:\Program Files\Java\jdk1.8.0_101\jre\bin\nio.dll
0x00007fffa87b0000 - 0x00007fffa8807000 C:\Users\mathm\AppData\Local\Temp\lwjglmathm\3.1.2-build-29\lwjgl.dll
0x00007fffa8770000 - 0x00007fffa87ac000 C:\Users\mathm\AppData\Local\Temp\lwjglmathm\3.1.2-build-29\jemalloc.dll
0x00007fffa5e30000 - 0x00007fffa5e6d000 C:\Users\mathm\AppData\Local\Temp\lwjglmathm\3.1.2-build-29\glfw.dll
0x00007fffb6ce0000 - 0x00007fffb6d75000 C:\WINDOWS\system32\uxtheme.dll
0x00007fffa4f50000 - 0x00007fffa4f92000 C:\WINDOWS\SYSTEM32\dinput8.dll
0x00007fffb4630000 - 0x00007fffb463e000 C:\WINDOWS\SYSTEM32\xinput1_4.dll
0x00007fffb6f90000 - 0x00007fffb6fb8000 C:\WINDOWS\SYSTEM32\DEVOBJ.dll
0x00007fffad130000 - 0x00007fffad15a000 C:\WINDOWS\SYSTEM32\dwmapi.dll
0x00007fffbb1f0000 - 0x00007fffbb356000 C:\WINDOWS\System32\MSCTF.dll
0x00007fffbb0d0000 - 0x00007fffbb190000 C:\WINDOWS\System32\OLEAUT32.dll
0x00007fffaccf0000 - 0x00007fffacd18000 c:\program files\nvidia corporation\nvstreamsrv\nvinject.dll
0x00007fffb7320000 - 0x00007fffb732d000 C:\WINDOWS\SYSTEM32\HID.DLL
0x00007fffbac90000 - 0x00007fffbb0cb000 C:\WINDOWS\System32\SETUPAPI.DLL
0x00007fffb8910000 - 0x00007fffb8966000 C:\WINDOWS\System32\WINTRUST.dll
0x00007fffb8500000 - 0x00007fffb8511000 C:\WINDOWS\System32\MSASN1.dll
0x00007fffb9200000 - 0x00007fffb93c9000 C:\WINDOWS\System32\CRYPT32.dll
0x00007fffa1290000 - 0x00007fffa13b1000 C:\WINDOWS\SYSTEM32\opengl32.dll
0x00007fffad870000 - 0x00007fffad89c000 C:\WINDOWS\SYSTEM32\GLU32.dll
0x00007fff66980000 - 0x00007fff676ca000 C:\WINDOWS\System32\DriverStore\FileRepository\igdlh64.inf_amd64_463164d40c3d26ce\ig9icd64.dll
0x00007fffb48f0000 - 0x00007fffb4903000 C:\WINDOWS\SYSTEM32\WTSAPI32.dll
0x00007fffa3730000 - 0x00007fffa488d000 C:\WINDOWS\System32\DriverStore\FileRepository\igdlh64.inf_amd64_463164d40c3d26ce\igc64.dll
0x00007fffaf3b0000 - 0x00007fffaf432000 C:\WINDOWS\System32\TextInputFramework.dll
0x00007fffb5ee0000 - 0x00007fffb5fc3000 C:\WINDOWS\System32\CoreMessaging.dll
0x00007fffa76a0000 - 0x00007fffa7972000 C:\WINDOWS\System32\CoreUIComponents.dll
0x00007fffb1f30000 - 0x00007fffb1f45000 C:\WINDOWS\SYSTEM32\usermgrcli.dll
0x00007fffb7670000 - 0x00007fffb76a1000 C:\WINDOWS\SYSTEM32\ntmarta.dll
0x00007fffb52d0000 - 0x00007fffb5409000 C:\WINDOWS\SYSTEM32\wintypes.dll
0x00007fffa1200000 - 0x00007fffa125c000 C:\Users\mathm\AppData\Local\Temp\lwjglmathm\3.1.2-build-29\lwjgl_opengl.dll
0x00007fffb42c0000 - 0x00007fffb4469000 C:\WINDOWS\SYSTEM32\dbghelp.dll

VM Arguments:
jvm_args: -javaagent:C:\Users\mathm\AppData\Local\JetBrains\Toolbox\apps\IDEA-C\ch-1\172.3968.16\lib\idea_rt.jar=53725:C:\Users\mathm\AppData\Local\JetBrains\Toolbox\apps\IDEA-C\ch-1\172.3968.16\bin -Dfile.encoding=UTF-8
java_command: com.meti.HelloTriangle
java_class_path (initial): C:\Program Files\Java\jdk1.8.0_101\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_101\jre\lib\rt.jar;C:\Meticuli\Projects\LwjglProjects\out\production\LwjglProjects;C:\Meticuli\Projects\LwjglProjects\libraries\lwjgl-3.1.2\lwjgl\lwjgl.jar;C:\Meticuli\Projects\LwjglProjects\libraries\lwjgl-3.1.2\lwjgl\lwjgl-javadoc.jar;C:\Meticuli\Projects\LwjglProjects\libraries\lwjgl-3.1.2\lwjgl\lwjgl-sources.jar;C:\Meticuli\Projects\LwjglProjects\libraries\lwjgl-3.1.2\lwjgl\lwjgl-natives-linux.jar;C:\Meticuli\Projects\LwjglProjects\libraries\lwjgl-3.1.2\lwjgl\lwjgl-natives-macos.jar;C:\Meticuli\Projects\LwjglProjects\libraries\lwjgl-3.1.2\lwjgl\lwjgl-natives-windows.jar;C:\Meticuli\Projects\LwjglProjects\libraries\lwjgl-3.1.2\lwjgl-assimp\lwjgl-assimp.jar;
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\mathm\AppData\Local\Microsoft\WindowsApps;
USERNAME=mathm
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 94 Stepping 3, GenuineIntel



--------------- S Y S T E M ---------------

OS: Windows 10.0 , 64 bit Build 15063 (10.0.15063.296)

CPU:total 8 (4 cores per cpu, 2 threads per core) family 6 model 94 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx

Memory: 4k page, physical 12476176k(7696764k free), swap 13296400k(7350476k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (25.101-b13) for windows-amd64 JRE (1.8.0_101-b13), built on Jun 22 2016 01:21:29 by "java_re" with MS VC++ 10.0 (VS2010)

time: Sat Sep 16 16:46:48 2017
elapsed time: 0 seconds (0d 0h 0m 0s)

我确实讨厌在 Java 中使用 native 代码,尽管知道 OpenGL 是一项很好的技能。

这是源代码:

package com.meti;

import org.lwjgl.glfw.GLFWErrorCallback;
import org.lwjgl.opengl.GL;

import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL15.GL_ARRAY_BUFFER;
import static org.lwjgl.opengl.GL15.glBindBuffer;
import static org.lwjgl.opengl.GL20.glEnableVertexAttribArray;
import static org.lwjgl.opengl.GL20.glVertexAttribPointer;
import static org.lwjgl.opengl.GL30.glBindVertexArray;
import static org.lwjgl.opengl.GL30.glGenVertexArrays;
import static org.lwjgl.opengl.GL45.glCreateBuffers;
import static org.lwjgl.opengl.GL45.glNamedBufferStorage;
import static org.lwjgl.system.MemoryUtil.NULL;

/**
* @author SirMathhman
* @version 0.0.0
* @since 9/8/2017
*/
public class HelloTriangle {
private static final int WIDTH = 800;
private static final int HEIGHT = 600;

private long window;
private int vaoID;

public static void main(String[] args) {
new HelloTriangle().run();
}

private void run() {
init();
loop();
}

private void init() {
GLFWErrorCallback.createPrint(System.err).set();

if (!glfwInit()) {
System.out.println("GLFW failed to initialize");
System.exit(-1);
}

glfwDefaultWindowHints();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);

window = glfwCreateWindow(WIDTH, HEIGHT, "HelloWindow", NULL, NULL);
if (window == NULL) {
System.out.println("GLFW failed to create window");
glfwTerminate();
System.exit(-1);
}

glfwMakeContextCurrent(window);
glfwShowWindow(window);

float[] vertices = {
-0.9f, -0.9f,
0.85f, -0.9f,
-0.9f, 0.85f,
0.9f, -0.85f,
0.9f, 0.9f,
-0.85f, 0.9f
};

int buffer = glCreateBuffers();
glNamedBufferStorage(buffer, vertices, vertices.length);

vaoID = glGenVertexArrays();
glBindVertexArray(vaoID);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glVertexAttribPointer(0, 2, GL_FLOAT, false, 0, 0);
glEnableVertexAttribArray(0);
}

private void loop() {
GL.createCapabilities();

while (!glfwWindowShouldClose(window)) {
glClear(GL_DEPTH_BUFFER_BIT);
glBindVertexArray(vaoID);
glDrawArrays(GL_TRIANGLES, 0, 6);

glfwSwapBuffers(window);
glfwPollEvents();
}

glfwTerminate();
System.exit(0);
}
}

PS:是否还有一种方法可以返回 LWJGL 驱动程序抛出的更详细的错误?

最佳答案

glCreateBuffersglNamedBufferStorage 是 OpenGL 4.5 命令。但您请求的是 3.3(glfwWindowHint 命令)。

如果您想坚持使用 3.3 版本,请尝试使用 glGenBuffers 创建缓冲区

关于java - LWJGL glCreateBuffers 导致问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46258356/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com