PDA

View Full Version : Single mesh versus array of mesh



DannySaucen
02-05-2012, 11:46 AM
Hello all,

I plan on loading data from COLLADA files into OpenGL for rendering.
Here is an incomplete (no ending tags) example of what we're looking at.

<library_geometries>
<geometry id="Box1-lib" name="Box1Mesh">
<mesh>
<geometry id="Box2-lib" name="Box2Mesh">
<mesh>

Notice how the two objects (Cubes) each have their own mesh.
My question, is whether to combine both meshes into a single CMesh class,
or have an array<CMesh> type of approach.
In either case, Mesh is my complete format for feeding the info into OpenGL.

There may be more overhead for a separate rendering of each mesh, but will combining the two together, then rendering have undesired effects?

carsten neumann
02-06-2012, 08:44 AM
If you want to draw them with a single draw call both meshes need to have the same "material" (i.e. textures, shaders, uniforms, etc.) and vertex format (e.g. same number of texture coordinates).