I’ve just recently decided to start using lwjgl instead of jogl and I seem to have run into a bit of a problem. I created a simple scene with some rotating cubes and such and everything works fine… until I try adding a light. I keep getting the error:
java.lang.IllegalArgumentException: FloatBuffer is not direct
when I call:
GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, ltAmbeint);
I’m creating ltAmbient like this:
float[] ambientValues = new float[]{.2f, .2f, .2f, 1.0f};
FloatBuffer ltAmbient= ByteBuffer.allocateDirect(16).order(ByteOrder.nativeOrder()).asFloatBuffer();
ltAmbient.put(ambientValues).flip();
I’ve looked at a couple other examples which seem to be doing this pretty much exactly the same and it appears to work. Any idea why my FloatBuffer isn’t direct? The code shown above is contained in my initGL() method which gets called immediately after the display is created.
ah well, its working now.