+ static int count = -1;
+ if(count<0)
+ {
+ if(ARB_vertex_shader)
+ count = get_i(GL_MAX_TEXTURE_IMAGE_UNITS);
+ else if(ARB_multitexture)
+ count = get_i(GL_MAX_TEXTURE_UNITS);
+ else
+ count = 1;
+ }
+ return count;
+}
+
+TexUnit &TexUnit::get_unit(unsigned n)
+{
+ if(n>0)
+ static Require _req(ARB_multitexture);
+ if(n>=get_n_units())
+ throw out_of_range("TexUnit::get_unit");