question about glLightfv

I’m using
FloatBuffer ambient=FloatBuffer.allocate(4);
ambient.put(new float[]{0.05f, 0.05f, 0.05f, 0.0f});

gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, ambient);

It doesn’t work, my scene remains unlit.
When I replace the call with
gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, ambient.array(),0);
It works fine.
Is there something wrong with the first way of calling it?

You need to call rewind() on your FloatBuffer before passing it in. We need more error checking in this area.

Thank you, now it’s working.