Number of remaining buffer elements is 0,must be at least 16

Started by appel, October 16, 2006, 10:39:41

Previous topic - Next topic

appel

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)

elias

The exception is thrown at a glLoadMatrix call, not a glLight?

- elias

appel

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 :)