I think I must be missing something pretty basic. (So i’m not sure if this post should go under basic or advanced…) Basically I have an obj file which, for argument’s sake is all triangles. The obj file format defines its faces (indices) as
f v0/n0/t0 v1/n1/t1 v2/n2/t2
However I dont actually see a way to interleave the index buffer! I wound up creating my vertex buffer as follows:
v/v/v n/n/n u/v
I have got everything rendering properly, but my IBO is quite literally a sequence of indicies from 0 to FACE_COUNT.
I can define an interleaved VBO as follows:
gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, ibo_id); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbo_id); gl.glVertexPointer(3, GL.GL_FLOAT, SIZEOF_VBO, 0); gl.glNormalPointer( GL.GL_FLOAT, SIZEOF_VBO, BufferUtil.SIZEOF_FLOAT * 3); gl.glTexCoordPointer(2, GL.GL_FLOAT, SIZEOF_VBO, BufferUtil.SIZEOF_FLOAT * (3+3)); (...) // render it out gl.glDrawArrays(render_type, section.getStart(), section.getCount());
Again, while everything “works”, in retrospect it seems setting up a IBO was relatively worthless, given I cant interleave it why use one at all? What am I missing? It seems like even if I were to create a monolithic IBO/VBO for all my 3D objects, I could just as easily tell the video card to start at a point in the VBO and render “count()” verts and skip the step of looking up verts in the IBO.