intbuffer.put problem

Started by pandur, March 04, 2008, 23:48:42

Previous topic - Next topic

pandur

Hi,

i had some troubles using gldrawbuffers, but it works now.

but please can enlighten me what is wrong? :)

this works:
IntBuffer ib=BufferUtils.createIntBuffer(2);
ib.put(0, EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT);
ib.put(1, EXTFramebufferObject.GL_COLOR_ATTACHMENT1_EXT);
GL20.glDrawBuffers(ib);

   
this does not work:
GL20.glDrawBuffers(BufferUtils.createIntBuffer(2).put(new int[]{EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT,	EXTFramebufferObject.GL_COLOR_ATTACHMENT1_EXT}));


i think it should give the same result...

thanks :D
      

Matzon

the latter doesn't work, because the put moves the internal pointer in the buffer. You need to call rewind on it.