# Applying different materials to an object

I'm currently implementing an Object Loader for the Wavefront File Format (*.obj). When exporting a model (with associated materials) from blender, a material for a group of faces is specified like this:

usemtl MyMaterial
s off
f 2/1/1 4/2/1 3/3/1
f 1/4/1 2/1/1 3/3/1


Since each material consists of (at least) 3 components for each of ambient, diffuse specular color and also shininess (which totals up to 10 floats) I would consider it to be a tremendous waste of memory to store all of these values for each vertex.

Does OpenGL provide us with a more elegant/viable way to achieve the same result with a more reasonable memory consumption or do I have to swallow the bitter pill?

• Yes, Uniforms. The simplest implementation would then need N Draw-Calls per mesh, where N is the number of unique Materials of the mesh. – dari Apr 19 '16 at 21:16