JVM Crash (3.0.0b)

Started by vidmaster, May 18, 2016, 18:11:33

Previous topic - Next topic

vidmaster

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...

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

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().

vidmaster

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  ;)