Index: shader.c
===================================================================
--- shader.c	(revision 684)
+++ shader.c	(revision 685)
@@ -373,7 +373,8 @@
     raydium_log("shader: cannot attach shader: Invalid shader");
     return 0;
     }
-if(texture<=0 || texture>=(int)raydium_texture_index)
+//if(texture<=0 || texture>=(int)raydium_texture_index)
+if(!raydium_texture_is_slot_used(texture))
     {
     raydium_log("shader: cannot attach shader: Invalid texture");
     return 0;