+void Texture::bind_scratch()
+{
+ if(!scratch_binding)
+ glActiveTexture(GL_TEXTURE0);
+ if(scratch_binding!=this)
+ {
+ if(scratch_binding && scratch_binding->target!=target)
+ glBindTexture(scratch_binding->target, 0);
+ glBindTexture(target, id);
+ scratch_binding = this;
+ }
+}
+
+void Texture::unbind_scratch()
+{
+ if(scratch_binding)
+ {
+ glBindTexture(scratch_binding->target, 0);
+ scratch_binding = 0;
+ }
+}
+