void bind_prog_and_attributes(const VertexFormat& vf, const Program& program) { program.bind(); for (auto&& vc : vf) { const auto attrib_loc = program.get_attribute_loc(vc.name); CHECK_FOR_GL_ERROR; glEnableVertexAttribArray(attrib_loc); CHECK_FOR_GL_ERROR; glVertexAttribPointer(attrib_loc, vc.num_comps, vc.type, vc.normalize, (GLsizei)vf.stride(), (const void*)vc.offset); CHECK_FOR_GL_ERROR; } }