]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texunit.cpp
Allow tagging objects in a scene file for retrieval after loading
[libs/gl.git] / source / texunit.cpp
index 74a23246b368ac6ad3b6b3d69765c5f6d4bbd82e..9277c27704ebd8347c3c6a782fc1b6ff05fc8658 100644 (file)
@@ -16,13 +16,16 @@ TexUnit *TexUnit::cur_unit = 0;
 
 TexUnit::TexUnit():
        legacy(false),
-       texture(0)
+       texture(0),
+       tex_legacy(false)
 { }
 
-bool TexUnit::set_texture(const Texture *tex)
+bool TexUnit::set_texture(const Texture *tex, bool lgc)
 {
-       bool result = (tex!=texture);
+       lgc = (lgc && legacy && tex);
+       bool result = (tex!=texture || lgc!=tex_legacy);
        texture = tex;
+       tex_legacy = lgc;
        return result;
 }
 
@@ -39,7 +42,7 @@ unsigned TexUnit::get_n_units()
        if(count<0)
        {
                if(ARB_vertex_shader)
-                       count = get_i(GL_MAX_TEXTURE_IMAGE_UNITS);
+                       count = get_i(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
                else if(ARB_multitexture)
                        count = get_i(GL_MAX_TEXTURE_UNITS);
                else