2 #include <msp/gl/extensions/arb_multitexture.h>
3 #include <msp/gl/extensions/arb_vertex_shader.h>
12 vector<TexUnit> TexUnit::units;
13 TexUnit *TexUnit::cur_unit = 0;
19 fill(texgen, texgen+4, static_cast<const TexGen *>(0));
22 bool TexUnit::set_texture(const Texture *tex)
24 bool result = (tex!=texture);
29 bool TexUnit::set_texenv(const TexEnv *env)
31 bool result = (texenv!=env);
36 bool TexUnit::set_texgen(unsigned i, const TexGen *gen)
39 throw out_of_range("TexUnit::set_texgen");
40 bool result = (texgen[i]!=gen);
45 const TexGen *TexUnit::get_texgen(unsigned i)
48 throw out_of_range("TexUnit::get_texgen");
52 unsigned TexUnit::get_n_units()
54 static int count = -1;
58 glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &count);
59 else if(ARB_multitexture)
60 glGetIntegerv(GL_MAX_TEXTURE_UNITS, &count);
67 TexUnit &TexUnit::activate(unsigned n)
70 static Require _req(ARB_multitexture);
72 throw out_of_range("TexUnit::activate");
77 if(cur_unit!=&units[n] && (cur_unit || n))
78 glActiveTexture(GL_TEXTURE0+n);
84 TexUnit &TexUnit::current()