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;
44 // XXX Should use GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS since GL 2.0
45 glGetIntegerv(GL_MAX_TEXTURE_UNITS, &count);
49 TexUnit &TexUnit::activate(unsigned n)
53 static RequireVersion _ver(1, 3);
55 throw InvalidParameterValue("Invalid texture unit number");
61 if(cur_unit!=&units[n] && (cur_unit || n))
62 glActiveTexture(GL_TEXTURE0+n);
68 TexUnit &TexUnit::current()