- else
- throw invalid_argument("make_indexed_component");
- return static_cast<VertexComponent>(comp+index*4);
+ else if(attr>=RAW_ATTRIB1 && attr<=RAW_ATTRIB4)
+ base &= 7;
+ else if(attr<GENERIC1 || attr>GENERIC4)
+ throw invalid_argument("make_indexed_attribute");
+
+ static int max_attribs = -1;
+ if(max_attribs<0)
+ max_attribs = get_i(GL_MAX_VERTEX_ATTRIBS);
+
+ if(static_cast<int>((base>>3)+index)>=max_attribs)
+ throw out_of_range("make_indexed_attribute");
+
+ return static_cast<VertexAttribute>(base+index*8);