Hello Everyone,
I'm quite new to lwjgl so in case I'm doing something obviously wrong please don't hesitate to correct me.
The situation I ran into is as follows. I know that lwjgl can really only work with direct buffers. I also assumed the api will transparently handle ( through NondirectBufferWrapper ) the passing-in of a non-direct buffer, so I ended up coding the following:
IntBuffer length = IntBuffer.allocate(1);
GL20.glGetProgram(program, GL20.GL_INFO_LOG_LENGTH, length);
ByteBuffer logBuffer = ByteBuffer.allocate(length.get(0));
GL20.glGetProgramInfoLog(program, length, logBuffer);
Strangely, the first 4 bytes of logBuffer were ending up clobbered with what turned out to be the byte contents of length. It appears that NondirectBufferWrapper is keeping, per-thread, a
single direct buffer so with a call that takes multiple buffers ( like glGetProgramInfoLog ) they will
all get mapped to the
same memory and things will end up being overwritten.
Am I missing something really huge here or is this an lwjgl bug ?