Hello Guest

JVM Crash (3.0.0b)

  • 2 Replies
  • 2175 Views
JVM Crash (3.0.0b)
« on: May 18, 2016, 18:11:33 »
Hey ho, I am crashing the JVM (or more precisely, the native code crashes the JVM). Either I am failing to understand something here, or we got a bug.

WHAT AM I DOING? Actually not much, I have a compiled shader (vertex and fragment), represented by the integer program in the code below. And then, I am trying to get its variables...

Code: [Select]
int numberOfUniformVars = glGetProgrami(program, GL_ACTIVE_UNIFORMS);
for (int i = 0; i < numberOfUniformVars; i++) {
String name = glGetActiveUniform(program, i, /** give me the name of the uniform at index for program */
/* since I am actually only interested in the name, so just create
* some buffers (which store value and type) that we do not use later */
IntBuffer.allocate(1), IntBuffer.allocate(1));

int location = glGetUniformLocation(program, name);
[...do other stuff...]
}

WHAT CRASHES? My call to glGetActiveUniform, at this point I am actually only interested in the name so maybe there is some LWJGL 2 to 3 migration bug still present in my code? I have attached a crashlog.

WHAT IS MY SETUP? I am using a pretty recent OpenJDK on my Xubuntu Linux, GTX680. LWJGL is 3.0.0b (from Maven Repository).

Am I doing something wrong or is there a bug present?

*

Kai

Re: JVM Crash (3.0.0b)
« Reply #1 on: May 18, 2016, 18:22:39 »
All buffers that you use as arguments to LWJGL methods must always be direct buffers. So either use ByteBuffer.allocateDirect().asIntBuffer() or just use LWJGL's BufferUtils.createIntBuffer().
« Last Edit: May 19, 2016, 07:38:35 by Kai »

Re: JVM Crash (3.0.0b)
« Reply #2 on: May 19, 2016, 17:28:30 »
thanks, that helped  :)   maybe add an assert or check for that, at least in the checked variants of the method? On the other hand, performance...

Okay, maybe more Javadoc  ;)