]> git.tdb.fi Git - libs/gl.git/blobdiff - source/renderer.cpp
Remove the deprecated ProgramBuilder class
[libs/gl.git] / source / renderer.cpp
index d4cbbfe3454e39ef91a881bcf72cb8e06e00628a..416a0fc89ced4827147982f234ca009fb94576c0 100644 (file)
@@ -9,6 +9,7 @@
 #include "programdata.h"
 #include "renderable.h"
 #include "renderer.h"
+#include "sampler.h"
 #include "texture.h"
 #include "texturing.h"
 #include "texunit.h"
@@ -73,9 +74,10 @@ void Renderer::transform(const Matrix &matrix)
        changed |= MATRIX;
 }
 
-void Renderer::set_texture(const Texture *t)
+void Renderer::set_texture(const Texture *t, const Sampler *s)
 {
        state->texture = t;
+       state->sampler = s;
        state->texturing = 0;
 }
 
@@ -83,6 +85,7 @@ void Renderer::set_texturing(const Texturing *t)
 {
        state->texturing = t;
        state->texture = 0;
+       state->sampler = 0;
 }
 
 unsigned Renderer::allocate_effect_texunit()
@@ -283,7 +286,13 @@ void Renderer::apply_state()
        {
                Texturing::unbind();
                if(state->texture)
+               {
+                       if(state->sampler)
+                               state->sampler->bind_to(0);
+                       else
+                               Sampler::unbind_from(0);
                        state->texture->bind_to(0);
+               }
                else
                        Texture::unbind_from(0);
        }