Interleaved IBO/VBO

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.

“Interleaved IBO” is probably the wrong word. I first thought you wanted to interleave vertex-data and indices in one big array, which is, of course, neither possible nor useful.

There are indeed cases, where you just want to render all vertices one after another. In this case not using an IBO and just calling glDrawArray is probably better than using an explicit IBO. If you find, that your data fits this criteria, don’t bother about it, it’s just like that.

I am pretty sure that you will encounter numerous situations, in which you will reuse vertices several times and thus using an IBO will make sense, in the (near) future.

Jan.