]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texunit.cpp
Remove the deprecated ProgramBuilder class
[libs/gl.git] / source / texunit.cpp
index fd36a4f15b5e77b7455af08ed4133f6e578c8c44..0659d6154e80523ffaa0baf75f6bf00ff96a05f2 100644 (file)
@@ -3,6 +3,7 @@
 #include <msp/gl/extensions/arb_vertex_shader.h>
 #include "gl.h"
 #include "misc.h"
+#include "texture.h"
 #include "texunit.h"
 
 using namespace std;
@@ -15,10 +16,8 @@ TexUnit *TexUnit::cur_unit = 0;
 
 TexUnit::TexUnit():
        texture(0),
-       texenv(0)
-{
-       fill(texgen, texgen+4, static_cast<const TexGen *>(0));
-}
+       sampler(0)
+{ }
 
 bool TexUnit::set_texture(const Texture *tex)
 {
@@ -27,29 +26,13 @@ bool TexUnit::set_texture(const Texture *tex)
        return result;
 }
 
-bool TexUnit::set_texenv(const TexEnv *env)
-{
-       bool result = (texenv!=env);
-       texenv = env;
-       return result;
-}
-
-bool TexUnit::set_texgen(unsigned i, const TexGen *gen)
+bool TexUnit::set_sampler(const Sampler *samp)
 {
-       if(i>=4)
-               throw out_of_range("TexUnit::set_texgen");
-       bool result = (texgen[i]!=gen);
-       texgen[i] = gen;
+       bool result = (samp!=sampler);
+       sampler = samp;
        return result;
 }
 
-const TexGen *TexUnit::get_texgen(unsigned i)
-{
-       if(i>=4)
-               throw out_of_range("TexUnit::get_texgen");
-       return texgen[i];
-}
-
 void TexUnit::bind()
 {
        if(cur_unit!=this && (cur_unit || index))
@@ -63,7 +46,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
@@ -105,13 +88,5 @@ TexUnit *TexUnit::find_unit(const Texture *tex)
        return 0;
 }
 
-TexUnit *TexUnit::find_unit(const TexEnv *env)
-{
-       for(vector<TexUnit>::iterator i=units.begin(); i!=units.end(); ++i)
-               if(i->texenv==env)
-                       return &*i;
-       return 0;
-}
-
 } // namespace GL
 } // namespace Msp