]> git.tdb.fi Git - libs/gl.git/commitdiff
Add static Texture::unbind_from function
authorMikko Rasa <tdb@tdb.fi>
Mon, 1 Feb 2010 20:02:33 +0000 (20:02 +0000)
committerMikko Rasa <tdb@tdb.fi>
Mon, 1 Feb 2010 20:02:33 +0000 (20:02 +0000)
Handle generic attributes in PrimitiveBuilder

source/primitivebuilder.cpp
source/texture.cpp
source/texture.h

index 6a4d9bf0b866ccd1585a68ef05acf9b1c42df682..95faa3fb5f74aee13e63f392bda69e4871d700e5 100644 (file)
@@ -55,9 +55,11 @@ PrimitiveType PrimitiveBuilder::get_type() const
 
 void PrimitiveBuilder::vertex_(float x, float y, float z, float w)
 {
-       vab.texcoord(ts, tt, tr,tq);
+       vab.texcoord(ts, tt, tr, tq);
        vab.color(cr, cg, cb, ca);
        vab.normal(nx, ny, nz);
+       for(std::map<unsigned, Attrib>::iterator i=av.begin(); i!=av.end(); ++i)
+               vab.attrib(i->first, i->second.x, i->second.y, i->second.z, i->second.w);
        vab.vertex(x, y, z, w);
 
        if(in_batch)
index d71f38c2f1f2efba27edf95c57925c0a11946f54..47b6ba37abb300f8fae19a83be1ace593001362f 100644 (file)
@@ -91,6 +91,12 @@ void Texture::unbind()
        TexUnit::current().set_texture(0);
 }
 
+void Texture::unbind_from(unsigned i)
+{
+       TexUnit::activate(i);
+       unbind();
+}
+
 Texture::Texture():
        target(0)
 {
index 61b1bebdbac92611e9fcc853eea99a4a4e19a5a4..48f551f0ae0d5ea591c984aeb49634a0742763b4 100644 (file)
@@ -62,6 +62,7 @@ public:
        uint  get_id() const                 { return id; }
 
        static void unbind();
+       static void unbind_from(unsigned);
 protected:
        uint   id;
        GLenum target;