That buffer allocation should also include an order call, like so:
temp = ByteBuffer.allocateDirect(2048).order(ByteOrder.nativeOrder()).asIntBuffer();
Anyway, I can't see how that code could work, since it's doing a temp.get(buffer) immediately after glSelectBuffer and before rendering anything. Or am I missing something?
This source code seems outdated and may contain other errors. If I had some time, I would have a deeper look at this example. I only noticed the common errors that I fixed several times somewhere else.
the official nehe site LWJGL source code (AFAIK) has not been updated in a while.
I submitted a fix to lesson27 stencil shadows ages ago. and it never got updated.
Maybe updating all lessons and putting the source code directly somewhere onto the official website of LWJGL would be better.