Here’s an odd problem I have at the moment with nio. I’ve pulled out the relevant lines of code here:
FloatBuffer red;
red = FloatBuffer.allocate(4);
red.put(1.0f);
red.put(0.0f);
red.put(0.0f);
red.put(1.0f);
If use this:
gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, red); <--- I get a black shape
Whereas if I use this:
gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, red.array(),0); <--- I get a nice red shape
wossup wivit? I would’ve thought that the first call was just a convenience method for the second anyway…
I also get the same problem if I use red = ByteBuffer.allocateDirect(4 * Float.SIZE).asFloatBuffer()
Thanks.
Tim