5 #include "version_1_3.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 invalid_argument("TexUnit::set_texgen");
40 bool result = (texgen[i]!=gen);
45 const TexGen *TexUnit::get_texgen(unsigned i)
48 throw invalid_argument("TexUnit::get_texgen");
52 unsigned TexUnit::get_n_units()
54 static int count = -1;
57 if(is_version_at_least(2, 0) || is_supported("GL_ARB_vertex_shader"))
58 glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &count);
59 else if(is_version_at_least(1, 3))
60 glGetIntegerv(GL_MAX_TEXTURE_UNITS, &count);
67 TexUnit &TexUnit::activate(unsigned n)
70 throw out_of_range("TexUnit::activate");
75 if(cur_unit!=&units[n] && (cur_unit || n))
76 glActiveTexture(GL_TEXTURE0+n);
82 TexUnit &TexUnit::current()