When I try to run code with GL30.glGenVertexArrays() the OpenGL natives crash.
(https://sun9-51.userapi.com/c854416/v854416035/f50ec/NwsQ6kDpj0g.jpg)
(https://sun9-34.userapi.com/c854416/v854416035/f50d9/7LMOcoZikh4.jpg)
(https://sun9-20.userapi.com/c854416/v854416035/f5110/r8O1Kl5zLGo.jpg)
P.S. I'm new to LWJGL and Java.
Doing OpenGL calls inside of a constructor and on top of that initializing an instance field directly at declaration is not a good idea. In your case, the GL call and the constructor is called in a static initializer block:
j org.lwjgl.opengl.GL30.nglGenVertexArrays(IJ)V+0
j org.lwjgl.opengl.GL30.glGenVertexArrays()I+20
j net.matorassan.simplegfx.VertexArray.<init>(I[F)V+5
j net.matorassan.cubes.DrawThread.<init>()V+407
j net.matorassan.cubes.Cubes.<clinit>()V+14 <---------- static initializer block in class "Cubes"
The static initializer block may possibly be a static field being initialized at declaration with a new instance of DrawThread.
Chances are that the OpenGL context has not been initialized then.
You may also want to run the JVM with: https://github.com/LWJGLX/debug#how
Quote from: KaiHH on September 12, 2019, 14:23:48
Doing OpenGL calls inside of a constructor and on top of that initializing an instance field directly at declaration is not a good idea. In your case, the GL call and the constructor is called in a static initializer block:
j org.lwjgl.opengl.GL30.nglGenVertexArrays(IJ)V+0
j org.lwjgl.opengl.GL30.glGenVertexArrays()I+20
j net.matorassan.simplegfx.VertexArray.<init>(I[F)V+5
j net.matorassan.cubes.DrawThread.<init>()V+407
j net.matorassan.cubes.Cubes.<clinit>()V+14 <---------- static initializer block in class "Cubes"
The static initializer block may possibly be a static field being initialized at declaration with a new instance of DrawThread.
Chances are that the OpenGL context has not been initialized then.
You may also want to run the JVM with: https://github.com/LWJGLX/debug#how
Oh thank you! I forgot about these lines:
(https://sun9-25.userapi.com/c854416/v854416035/f51b3/N6d5iw0g1aY.jpg)