• FEATURED
• FEATURED
• FEATURED
• FEATURED
• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# FloatBuffer.put(float vertices[]) vs FloatBuffer.put(float[] src, int offset, int length)

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1PaulJabs  Members

Posted 16 July 2013 - 06:29 AM

Hello programmers,

I am sure that i am in the correct section because this is opengl with regards to android game development.
I study a book which is a pdf and i found early chapters using FloatBuffer.put(float vertices[]) and i understand that. But for the next chapters they use FloatBuffer.put(float[] src, int offset, int length). I am hoping someone can answer what is the difference between the two. What is the meaning and what is the importance of offset and length in FloatBuffer.put(float[] src, int offset, int length). Thanks a lot.

### #2Dave Hunt  Members

Posted 16 July 2013 - 11:41 AM

FloatBuffer.put(float[] vertices) adds all elements of the vertices array to the buffer.

FloatBuffer.put(float[] src,int offset, int length) adds "length" elements of the src array starting at the "offset" element of the src array to the buffer. e.g. starting at src[offset] and continuing for "length" elements.

Actually, this isn't really an OpenGL question. FloatBuffer is part of Java and is not specific to OpenGL at all.

### #3PaulJabs  Members

Posted 16 July 2013 - 01:17 PM

FloatBuffer.put(float[] vertices) adds all elements of the vertices array to the buffer.

FloatBuffer.put(float[] src,int offset, int length) adds "length" elements of the src array starting at the "offset" element of the src array to the buffer. e.g. starting at src[offset] and continuing for "length" elements.

Actually, this isn't really an OpenGL question. FloatBuffer is part of Java and is not specific to OpenGL at all.

A thanks. i get it.  If you have:

float v[] = {1,2,3,4,5,6,7,8,9,10};
FloatBuffer.put[v,2,2];

Yes, this is not opengl.

Edited by PaulJabs, 16 July 2013 - 01:19 PM.

### #4Dave Hunt  Members

Posted 16 July 2013 - 01:38 PM

A thanks. i get it.  If you have:

float v[] = {1,2,3,4,5,6,7,8,9,10};
FloatBuffer.put[v,2,2];