LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: appel on October 16, 2006, 10:39:41

Title: Number of remaining buffer elements is 0,must be at least 16
Post by: appel on October 16, 2006, 10:39:41
This is what I'm doing:
FloatBuffer buffer = BufferUtils.createFloatBuffer(4);
float[] lightArr = new float[4];
lightArr[0] = 1.0f;
lightArr[1] = 1.0f;
lightArr[2] = 1.0f;
lightArr[3] = 1.0f;
glLight(GL_LIGHT0, GL_DIFFUSE, (FloatBuffer) buffer.put( lightArr).flip());


^ isn't this possible? Why is this so much issue?



error:
Exception in thread "main" java.lang.IllegalArgumentException: Number of remaining buffer elements is 0, must be at least 16
at org.lwjgl.BufferChecks.throwBufferSizeException(BufferChecks.java:184)
at org.lwjgl.BufferChecks.checkBufferSize(BufferChecks.java:199)
at org.lwjgl.BufferChecks.checkBuffer(BufferChecks.java:224)
at org.lwjgl.opengl.GL11.glLoadMatrix(GL11.java:1627)
Title: Number of remaining buffer elements is 0,must be at least 16
Post by: elias on October 16, 2006, 10:42:11
The exception is thrown at a glLoadMatrix call, not a glLight?

- elias
Title: Number of remaining buffer elements is 0,must be at least 16
Post by: appel on October 16, 2006, 10:45:11
HAHA :) Look like I have to go back to debugging 101 :)

Yes, that's true, I've been staring too look at the screen now... thanks, fixed all my problems :)