-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007-2008 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
#include "extension.h"
#include "gl.h"
#include "texunit.h"
{
static int count = -1;
if(count<0)
- // XXX Should use GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS since GL 2.0
- glGetIntegerv(GL_MAX_TEXTURE_UNITS, &count);
+ {
+ if(is_version_at_least(2, 0) || is_supported("ARB_vertex_shader"))
+ glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &count);
+ else if(is_version_at_least(1, 3))
+ glGetIntegerv(GL_MAX_TEXTURE_UNITS, &count);
+ else
+ count = 1;
+ }
return count;
}
TexUnit &TexUnit::activate(unsigned n)
{
- if(n>0)
- {
- static RequireVersion _ver(1, 3);
- if(n>=get_n_units())
- throw InvalidParameterValue("Invalid texture unit number");
- }
+ if(n>=get_n_units())
+ throw InvalidParameterValue("Invalid texture unit number");
if(units.size()<=n)
units.resize(n+1);