4 #include "version_1_3.h"
11 vector<TexUnit> TexUnit::units;
12 TexUnit *TexUnit::cur_unit = 0;
19 bool TexUnit::set_texture(const Texture *tex)
21 bool result = (tex!=texture);
26 bool TexUnit::set_texenv(const TexEnv *env)
28 bool result = (texenv!=env);
33 unsigned TexUnit::get_n_units()
35 static int count = -1;
38 if(is_version_at_least(2, 0) || is_supported("ARB_vertex_shader"))
39 glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &count);
40 else if(is_version_at_least(1, 3))
41 glGetIntegerv(GL_MAX_TEXTURE_UNITS, &count);
48 TexUnit &TexUnit::activate(unsigned n)
51 throw InvalidParameterValue("Invalid texture unit number");
56 if(cur_unit!=&units[n] && (cur_unit || n))
57 glActiveTexture(GL_TEXTURE0+n);
63 TexUnit &TexUnit::current()