Soundbomber's picture

VBO's and InterleavedArrayFormat

I have buffers that contain 2 set of vertices (in interleaved array format) and two sets of indices (4 buffer objects in all).
I am drawing my objects thus:-

oGL.InterleavedArrays(InterleavedArrayFormat.T2fC4fN3fV3f, 0, Nothing)
oGL.DrawElements(BeginMode.Triangles, oObject.oSolidIndices.Length, DrawElementsType.UnsignedShort, IntPtr.Zero)

My question is this, how do I draw one object (buffers 0 and 1) and then draw the next object (buffers 2 and 3)?
When using interleaved arrays, do I have to use oGL.BindBuffer to specify which object I am referring to or does the interleaved format handle that?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Soundbomber's picture

Just to clarify, I want to draw 2 objects: 1 - A solid object, 2 - A wire frame object
Therefore I have 4 buffer objects: 1 - Solid Vertices (interleaved), 2 - Solid Indices, 3 - Wire frame vertices (interleaved), 4 - Wire frame indices.
I want to draw the solid object and then the wire frame object, but am unsure as how to point to the correct buffer objects.
My code works for a single object (2 buffer objects - 1 - Vertices (interleaved), 2 - Indices), but can't seem to get more than one to work.
Hope this makes sense.

the Fiddler's picture

You have to bind the relevant buffers before rendering each object, i.e.:

GL.BindBuffer(BufferTarget.ArrayBuffer, solid_vertices.Id);
GL.BindBuffer(BufferTarget.ElementArrayBuffer, solid_elements.Id);
// Render
GL.BindBuffer(BufferTarget.ArrayBuffer, wire_vertices.Id);
GL.BindBuffer(BufferTarget.ElementArrayBuffer, wire_elements.Id);
// Render
Soundbomber's picture

Cool. Thank you.