From: Mikko Rasa Date: Mon, 1 Feb 2010 20:02:33 +0000 (+0000) Subject: Add static Texture::unbind_from function X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=2508306f82675546be3c98e1eb556bae62ed2ccd;p=libs%2Fgl.git Add static Texture::unbind_from function Handle generic attributes in PrimitiveBuilder --- diff --git a/source/primitivebuilder.cpp b/source/primitivebuilder.cpp index 6a4d9bf0..95faa3fb 100644 --- a/source/primitivebuilder.cpp +++ b/source/primitivebuilder.cpp @@ -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::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) diff --git a/source/texture.cpp b/source/texture.cpp index d71f38c2..47b6ba37 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -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) { diff --git a/source/texture.h b/source/texture.h index 61b1bebd..48f551f0 100644 --- a/source/texture.h +++ b/source/texture.h @@ -62,6 +62,7 @@ public: uint get_id() const { return id; } static void unbind(); + static void unbind_from(unsigned); protected: uint id; GLenum target;