# Messing with VertexBuffer Questions

Ok some basic questions i think…

I'm messing with the float buffer aquired from  Geometry.getVertexBuffer()

first.) It says that the floats came in sets of 3 (x,y,z) to make up one vertex. Now, do the first three vertecies make up a triangle in the mesh? What i'm basically asking is, if i were to call geometry.getVertexBuffer().get() 9 times, would i get one of the triangles used in the mesh? Then if i call it another 9 times i get the next triangle, and so on? (I'm thinking probably not)

second.) When modifying the vertex buffer, what do i have to watch out? I know that i'm also going to have to update the NormalBuffer accordingly. And possibly have to update my modelbounds if i make any major changes. Is there anything else? What else do i have to pay attention to when playing with the vertices?

third.) this is related to my first and second question. How do i know which normal in the normalBuffer corresponds to which triangle in my geometry so that i can properly recalculate my normals? Are they ordered so that they correspond to one another?

Thanks for reading my post! I'm sure you guys will be able to help me out!

oh, i always thought of the normal being a vector perpendicular to the plane, facing forward. Thanks for the tip of checking out box i'm sure i'l learn lots more there!

They're normal nio Buffers, so you can read the Java API docs regarding the get() method.

If you want to change the vertices and such, make sure you don't use any locking or VBO.

ohoy!

normals are per vertex and not per triangle. would be hard to get anything else than hard edges otherwise. you can see it like every vertex can have, a normal, a color and a texture coordinate if wanted.

most meshes(about all in jme) uses indexed vertices. that is, you have an intbuffer that describes which vertices that define every triangle. have a look in jME's Box class for simple example of how it is used…