3 This file is part of libmspgl
4 Copyright © 2007-2008 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
11 #include "version_1_3.h"
18 vector<TexUnit> TexUnit::units;
19 TexUnit *TexUnit::cur_unit = 0;
26 bool TexUnit::set_texture(const Texture *tex)
28 bool result = (tex!=texture);
33 bool TexUnit::set_texenv(const TexEnv *env)
35 bool result = (texenv!=env);
40 unsigned TexUnit::get_n_units()
42 static int count = -1;
45 if(is_version_at_least(2, 0) || is_supported("ARB_vertex_shader"))
46 glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &count);
47 else if(is_version_at_least(1, 3))
48 glGetIntegerv(GL_MAX_TEXTURE_UNITS, &count);
55 TexUnit &TexUnit::activate(unsigned n)
58 throw InvalidParameterValue("Invalid texture unit number");
63 if(cur_unit!=&units[n] && (cur_unit || n))
64 glActiveTexture(GL_TEXTURE0+n);
70 TexUnit &TexUnit::current()