[WORKAROUNDED] Strange NullPointerException in ARBBufferObject.glMapBufferARB

Started by wondersonic, August 16, 2010, 14:13:11

Previous topic - Next topic

wondersonic

Hello,
I'm encountering some strange errors and I would like to know if someone can explain me the reason:

LWJGL: 2.5
org.lwjgl.util.NoChecks=true
OS: Windows XP
Video card: Intel 965/963 Graphics Media Accelerator with latest drivers (256Mb memory)
Reproductible: every time

application stacktrace:
java.lang.NullPointerException
	at org.lwjgl.opengl.ARBBufferObject.glMapBufferARB(ARBBufferObject.java:269)
	at tf4r.entities.Entity.drawVBO(Entity.java:387)


public static java.nio.ByteBuffer glMapBufferARB(int target, int access, long length, java.nio.ByteBuffer old_buffer) {
		ContextCapabilities caps = GLContext.getCapabilities();
		long function_pointer = caps.ARB_buffer_object_glMapBufferARB_pointer;
		BufferChecks.checkFunctionAddress(function_pointer);
		if (old_buffer != null)
			BufferChecks.checkDirect(old_buffer);
		java.nio.ByteBuffer __result = nglMapBufferARB(target, access, length, old_buffer, function_pointer);
		return __result.order(ByteOrder.nativeOrder());
	}


Line 269:
return __result.order(ByteOrder.nativeOrder());


I assume the __result variable is null but can anybody tell me when this can happen?  ???

Thans a lot in advance!

WS
S.

wondersonic

Note that old_buffer is not null and the VBO has already be displayed with success.

S.

wondersonic

I also use 2 display-lists in the application. And commenting both GL11.glCallList seems to solve my problem  ???  ???  ???  ???
S.

Eistoeter

Hum I don't see any GL11.glCallList in your code.

The exception trace indeed indicates that __result is null. The only situation this can happen is if nglMapBufferARB returns null. The NPE is not in nglMapBufferARB but in your own code therefore.

To find out why nglMapBufferARB returns null the easiest way is to associate the lwjgl.jar with the LWJGL source and debug into it and see what's going on.

spasi

The NullPointerException is indeed an LWJGL bug, there should be a null check before the .order call. There must also be a problem with your code for glMapBuffer to return null though. Check the GL error after the MapBuffer call, is it an OUT_OF_MEMORY or an INVALID_OPERATION error? Maybe the buffer is already mapped or something?

wondersonic

Quote from: Eistoeter on August 16, 2010, 20:28:13
Hum I don't see any GL11.glCallList in your code.

The exception trace indeed indicates that __result is null. The only situation this can happen is if nglMapBufferARB returns null. The NPE is not in nglMapBufferARB but in your own code therefore.

The code pasted is LWJGL code  ;)

Quote from: Eistoeter on August 16, 2010, 20:28:13To find out why nglMapBufferARB returns null the easiest way is to associate the lwjgl.jar with the LWJGL source and debug into it and see what's going on.

Did it and indeed __result is null, but since it is compiled code afterwards... I can't continue to debug.

Quote from: spasi on August 16, 2010, 22:14:14
The NullPointerException is indeed an LWJGL bug, there should be a null check before the .order call. There must also be a problem with your code for glMapBuffer to return null though. Check the GL error after the MapBuffer call, is it an OUT_OF_MEMORY or an INVALID_OPERATION error? Maybe the buffer is already mapped or something?

As far as I can understand the situation, I didn't modify anything in my VBO code.

The NullPointerException is thrown randomly (understand the JVM crashes sometimes before the Exception could have been handled).
When I get the Exception following, GL11.glGetError() returns 0 (no error)  :o

The only way to solve this problem is by commenting (in an other class the GL11.glCallList). What I don't understand is that my code works on an other computer with the only difference being the video card (supporting oepngl 3 whereas where I get the problem it only supports opengl 1.5).

I can post a JVM crash file if needed.
S.

wondersonic

Ok, very strange behaviour. I recoded display list to use VBOs and now it works like a charm!

So it seems to be a driver/card limitation.
S.