LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: pandur on March 04, 2008, 23:48:42

Title: intbuffer.put problem
Post by: pandur on March 04, 2008, 23:48:42
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
      
Title: Re: intbuffer.put problem
Post by: Matzon on March 05, 2008, 06:37:32
the latter doesn't work, because the put moves the internal pointer in the buffer. You need to call rewind on it.