Index: /trunk/nv/gl/gl_device.hh
===================================================================
--- /trunk/nv/gl/gl_device.hh	(revision 69)
+++ /trunk/nv/gl/gl_device.hh	(revision 70)
@@ -26,5 +26,5 @@
 		virtual index_buffer* create_index_buffer( buffer_hint hint, int size, void* source = nullptr );
 		virtual vertex_array* create_vertex_array();
-		virtual texture2d* create_texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler, void* data = nullptr );
+		virtual texture2d* create_texture2d( ivec2 size, image_format aformat, datatype adatatype, sampler asampler, void* data = nullptr );
 		virtual ~gl_device();
 	private:
Index: /trunk/nv/gl/gl_enum.hh
===================================================================
--- /trunk/nv/gl/gl_enum.hh	(revision 69)
+++ /trunk/nv/gl/gl_enum.hh	(revision 70)
@@ -37,6 +37,6 @@
 	unsigned int primitive_to_enum( primitive p );
 
-	unsigned int type_to_gl_enum( etype type );
-	etype gl_enum_to_type( unsigned int gl_enum );
+	unsigned int datatype_to_gl_enum( datatype type );
+	datatype gl_enum_to_datatype( unsigned int gl_enum );
 
 } // namespace nv
Index: /trunk/nv/gl/gl_texture2d.hh
===================================================================
--- /trunk/nv/gl/gl_texture2d.hh	(revision 69)
+++ /trunk/nv/gl/gl_texture2d.hh	(revision 70)
@@ -22,5 +22,5 @@
 	{
 	public:
-		gl_texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler, void* data = nullptr );
+		gl_texture2d( ivec2 size, image_format aformat, datatype adatatype, sampler asampler, void* data = nullptr );
 		virtual void assign( void* data );
 		virtual void bind( int slot = 0 );
Index: /trunk/nv/interface/device.hh
===================================================================
--- /trunk/nv/interface/device.hh	(revision 69)
+++ /trunk/nv/interface/device.hh	(revision 70)
@@ -31,5 +31,5 @@
 		virtual index_buffer* create_index_buffer( buffer_hint hint, int size, void* source = nullptr ) = 0;
 		virtual vertex_array* create_vertex_array() = 0;
-		virtual texture2d* create_texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler, void* data = nullptr ) = 0;
+		virtual texture2d* create_texture2d( ivec2 size, image_format aformat, datatype adatatype, sampler asampler, void* data = nullptr ) = 0;
 	};
 
Index: /trunk/nv/interface/program.hh
===================================================================
--- /trunk/nv/interface/program.hh	(revision 69)
+++ /trunk/nv/interface/program.hh	(revision 70)
@@ -25,27 +25,16 @@
 	{
 	public:
-		attribute( 
-			const string& name,
-			int location,
-			etype type,
-			int length ) :
-			m_name( name ),
-			m_location( location ),
-			m_type( type ),
-			m_length( length )
-		{
-
-		}
-
+		attribute( const string& name, int location, datatype type,	int length ) :
+			m_name( name ),	m_location( location ),	m_type( type ), m_length( length ) {}
 		const string& get_name() const { return m_name; }
 		int get_location() const { return m_location; }
-		etype get_type() const { return m_type; }
+		datatype get_type() const { return m_type; }
 		int get_length() const { return m_length; }
 
 	protected:
-		string m_name;
-		int    m_location;
-		etype  m_type;
-		int    m_length;
+		string   m_name;
+		int      m_location;
+		datatype m_type;
+		int      m_length;
 	};
 
@@ -53,7 +42,7 @@
 	{
 	public: 
-		uniform_base( const string& name, etype type, int location, int length ) 
+		uniform_base( const string& name, datatype type, int location, int length ) 
 			: m_name( name ), m_type( type ), m_location(location), m_length( length ), m_dirty( true ) {}
-		etype get_type() const { return m_type; }
+		datatype get_type() const { return m_type; }
 		int get_location() const { return m_location; }
 		int get_length() const { return m_length; }
@@ -61,9 +50,9 @@
 		void clean() { m_dirty = false; }
 	protected:
-		string m_name;
-		etype  m_type;
-		int    m_location;
-		int    m_length;
-		bool   m_dirty;
+		string   m_name;
+		datatype m_type;
+		int      m_location;
+		int      m_length;
+		bool     m_dirty;
 	};
 
@@ -164,5 +153,5 @@
 		}
 	protected:
-		uniform_base* create_uniform( etype utype, const string& name, int location, int length )
+		uniform_base* create_uniform( datatype utype, const string& name, int location, int length )
 		{
 			switch( utype )
Index: /trunk/nv/interface/texture2d.hh
===================================================================
--- /trunk/nv/interface/texture2d.hh	(revision 69)
+++ /trunk/nv/interface/texture2d.hh	(revision 70)
@@ -60,5 +60,5 @@
 	public:
 
-		texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler ) : 
+		texture2d( ivec2 size, image_format aformat, datatype adatatype, sampler asampler ) : 
 			m_size( size ), m_format( aformat ), m_datatype( adatatype ), m_sampler( asampler ) {}
 		virtual void assign( void* data ) = 0;
@@ -70,10 +70,10 @@
 		int get_height() const { return m_size.y; }
 		image_format get_format() const { return m_format; }
-		etype get_datatype() const { return m_datatype; }
+		datatype get_datatype() const { return m_datatype; }
 		const sampler& get_sampler() const { return m_sampler; }
 	protected:
 		ivec2        m_size;
 		image_format m_format;
-		etype         m_datatype;
+		datatype     m_datatype;
 		sampler      m_sampler;
 	};
Index: /trunk/nv/interface/vertex_buffer.hh
===================================================================
--- /trunk/nv/interface/vertex_buffer.hh	(revision 69)
+++ /trunk/nv/interface/vertex_buffer.hh	(revision 70)
@@ -58,9 +58,9 @@
 	{
 	public:
-		vertex_buffer_attribute( vertex_buffer* buffer, etype datatype, int components, int offset = 0, int stride = 0, bool owner = true )
+		vertex_buffer_attribute( vertex_buffer* buffer, datatype datatype, int components, int offset = 0, int stride = 0, bool owner = true )
 			: m_buffer( buffer ), m_datatype( datatype ), m_components( components ), m_offset( offset ), m_stride( stride ), m_owner( owner ) {}
 
 		vertex_buffer* get_buffer() const { return m_buffer; }
-		etype get_datatype() const { return m_datatype; }
+		datatype get_datatype() const { return m_datatype; }
 		int get_components() const { return m_components; }
 		int get_offset() const { return m_offset; }
@@ -76,5 +76,5 @@
 	protected:
 		vertex_buffer* m_buffer;
-		etype           m_datatype;
+		datatype       m_datatype;
 		int  m_components;
 		int  m_offset;
@@ -89,5 +89,5 @@
 	public:
 		vertex_array() : m_map(), m_index( nullptr ) {}
-		void add_vertex_buffer( int location, vertex_buffer* buffer, etype datatype, int components, int offset = 0, int stride = 0, bool owner = true ) 
+		void add_vertex_buffer( int location, vertex_buffer* buffer, datatype datatype, int components, int offset = 0, int stride = 0, bool owner = true ) 
 		{
 			m_map[ location ] = new vertex_buffer_attribute( buffer, datatype, components, offset, stride, owner );
Index: /trunk/nv/types.hh
===================================================================
--- /trunk/nv/types.hh	(revision 69)
+++ /trunk/nv/types.hh	(revision 70)
@@ -20,5 +20,5 @@
 {
 
-	enum etype
+	enum datatype
 	{
 		INT,
@@ -44,7 +44,39 @@
 	};
 
-	typedef glm::detail::tvec2<uint8> i8vec2;
-	typedef glm::detail::tvec3<uint8> i8vec3;
-	typedef glm::detail::tvec4<uint8> i8vec4;
+	template <typename T> 
+	struct etype_traits 
+	{
+		typedef T type;
+		typedef T base_type;
+		static const size_t size = 1;
+	};
+
+	template <typename T> 
+	struct etype_traits< glm::detail::tvec2<T> > 
+	{
+		typedef glm::detail::tvec2<T> type;
+		typedef typename type::value_type base_type;
+		static const size_t size = 2;
+	};
+
+	template <typename T> 
+	struct etype_traits< glm::detail::tvec3<T> > 
+	{
+		typedef glm::detail::tvec3<T> type;
+		typedef typename type::value_type base_type;
+		static const size_t size = 3;
+	};
+
+	template <typename T> 
+	struct etype_traits< glm::detail::tvec4<T> > 
+	{
+		typedef glm::detail::tvec4<T> type;
+		typedef typename type::value_type base_type;
+		static const size_t size = 4;
+	};
+
+	typedef glm::detail::tvec2<sint8> i8vec2;
+	typedef glm::detail::tvec3<sint8> i8vec3;
+	typedef glm::detail::tvec4<sint8> i8vec4;
 
 	typedef glm::vec2 vec2;
@@ -60,5 +92,5 @@
 	typedef glm::mat4 mat4;
 
-	template < etype EnumType > struct enum_to_type {};
+	template < datatype EnumType > struct enum_to_type {};
 
 	template <> struct enum_to_type< INT >   { typedef int type; };
@@ -88,27 +120,28 @@
 	template < typename TYPE > struct type_to_enum {};
 
-	template <> struct type_to_enum< int >           { static const etype type = INT; };
-	template <> struct type_to_enum< unsigned int >  { static const etype type = UINT; };
-	template <> struct type_to_enum< short >         { static const etype type = SHORT; };
-	template <> struct type_to_enum< unsigned short >{ static const etype type = USHORT; };
-	template <> struct type_to_enum< char >          { static const etype type = BYTE; };
-	template <> struct type_to_enum< unsigned char > { static const etype type = UBYTE; };
-	template <> struct type_to_enum< f32 > { static const etype type = FLOAT; };
-
-	template <> struct type_to_enum< vec2 > { static const etype type = FLOAT_VECTOR_2; };
-	template <> struct type_to_enum< vec3 > { static const etype type = FLOAT_VECTOR_3; };
-	template <> struct type_to_enum< vec4 > { static const etype type = FLOAT_VECTOR_4; };
-
-	template <> struct type_to_enum< ivec2 > { static const etype type = INT_VECTOR_2; };
-	template <> struct type_to_enum< ivec3 > { static const etype type = INT_VECTOR_3; };
-	template <> struct type_to_enum< ivec4 > { static const etype type = INT_VECTOR_4; };
-
-	template <> struct type_to_enum< i8vec2 > { static const etype type = BYTE_VECTOR_2; };
-	template <> struct type_to_enum< i8vec3 > { static const etype type = BYTE_VECTOR_3; };
-	template <> struct type_to_enum< i8vec4 > { static const etype type = BYTE_VECTOR_4; };
-
-	template <> struct type_to_enum< mat2 > { static const etype type = FLOAT_MATRIX_2; };
-	template <> struct type_to_enum< mat3 > { static const etype type = FLOAT_MATRIX_3; };
-	template <> struct type_to_enum< mat4 > { static const etype type = FLOAT_MATRIX_4; };
+	template <> struct type_to_enum< int >           { static const datatype type = INT; };
+	template <> struct type_to_enum< unsigned int >  { static const datatype type = UINT; };
+	template <> struct type_to_enum< short >         { static const datatype type = SHORT; };
+	template <> struct type_to_enum< unsigned short >{ static const datatype type = USHORT; };
+	template <> struct type_to_enum< char >          { static const datatype type = BYTE; };
+	template <> struct type_to_enum< signed char >   { static const datatype type = BYTE; };
+	template <> struct type_to_enum< unsigned char > { static const datatype type = UBYTE; };
+	template <> struct type_to_enum< f32 > { static const datatype type = FLOAT; };
+
+	template <> struct type_to_enum< vec2 > { static const datatype type = FLOAT_VECTOR_2; };
+	template <> struct type_to_enum< vec3 > { static const datatype type = FLOAT_VECTOR_3; };
+	template <> struct type_to_enum< vec4 > { static const datatype type = FLOAT_VECTOR_4; };
+
+	template <> struct type_to_enum< ivec2 > { static const datatype type = INT_VECTOR_2; };
+	template <> struct type_to_enum< ivec3 > { static const datatype type = INT_VECTOR_3; };
+	template <> struct type_to_enum< ivec4 > { static const datatype type = INT_VECTOR_4; };
+
+	template <> struct type_to_enum< i8vec2 > { static const datatype type = BYTE_VECTOR_2; };
+	template <> struct type_to_enum< i8vec3 > { static const datatype type = BYTE_VECTOR_3; };
+	template <> struct type_to_enum< i8vec4 > { static const datatype type = BYTE_VECTOR_4; };
+
+	template <> struct type_to_enum< mat2 > { static const datatype type = FLOAT_MATRIX_2; };
+	template <> struct type_to_enum< mat3 > { static const datatype type = FLOAT_MATRIX_3; };
+	template <> struct type_to_enum< mat4 > { static const datatype type = FLOAT_MATRIX_4; };
 
 	template <typename TYPE>
Index: /trunk/src/gl/gl_device.cc
===================================================================
--- /trunk/src/gl/gl_device.cc	(revision 69)
+++ /trunk/src/gl/gl_device.cc	(revision 70)
@@ -67,5 +67,5 @@
 }
 
-texture2d* gl_device::create_texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler, void* data /*= nullptr */ )
+texture2d* gl_device::create_texture2d( ivec2 size, image_format aformat, datatype adatatype, sampler asampler, void* data /*= nullptr */ )
 {
 	return new gl_texture2d( size, aformat, adatatype, asampler, data );
Index: /trunk/src/gl/gl_enum.cc
===================================================================
--- /trunk/src/gl/gl_enum.cc	(revision 69)
+++ /trunk/src/gl/gl_enum.cc	(revision 70)
@@ -185,5 +185,5 @@
 }
 
-unsigned int nv::type_to_gl_enum( etype type )
+unsigned int nv::datatype_to_gl_enum( datatype type )
 {
 	switch( type )
@@ -213,5 +213,5 @@
 }
 
-nv::etype nv::gl_enum_to_type( unsigned int gl_enum )
+nv::datatype nv::gl_enum_to_datatype( unsigned int gl_enum )
 {
 	switch( gl_enum )
@@ -233,5 +233,5 @@
 	case GL_INT_VEC3       : return INT_VECTOR_3;
 	case GL_INT_VEC4       : return INT_VECTOR_4;
-	default : return etype(0); // TODO: throw!
-	}
-}
+	default : return datatype(0); // TODO: throw!
+	}
+}
Index: /trunk/src/gl/gl_program.cc
===================================================================
--- /trunk/src/gl/gl_program.cc	(revision 69)
+++ /trunk/src/gl/gl_program.cc	(revision 70)
@@ -156,5 +156,5 @@
 		int attr_loc = glGetAttribLocation( m_name.get_value(), name.c_str() );
 
-		m_attribute_map[ name ] = new attribute( name, attr_loc, gl_enum_to_type( attr_type ), attr_len );
+		m_attribute_map[ name ] = new attribute( name, attr_loc, gl_enum_to_datatype( attr_type ), attr_len );
 	}
 }
@@ -180,5 +180,5 @@
 
 		int uni_loc = glGetUniformLocation( m_name.get_value(), name.c_str() );
-		etype utype = gl_enum_to_type( uni_type );
+		datatype utype = gl_enum_to_datatype( uni_type );
 		m_uniform_map[ name ] = create_uniform( utype, name, uni_loc, uni_len );
 	}
Index: /trunk/src/gl/gl_texture2d.cc
===================================================================
--- /trunk/src/gl/gl_texture2d.cc	(revision 69)
+++ /trunk/src/gl/gl_texture2d.cc	(revision 70)
@@ -10,5 +10,5 @@
 using namespace nv;
 
-nv::gl_texture2d::gl_texture2d( ivec2 size, image_format aformat, etype adatatype, sampler asampler, void* data /*= nullptr */ )
+nv::gl_texture2d::gl_texture2d( ivec2 size, image_format aformat, datatype adatatype, sampler asampler, void* data /*= nullptr */ )
 	: texture2d( size, aformat, adatatype, asampler ), m_name()
 {
@@ -31,5 +31,5 @@
 {
 	glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
-	glTexImage2D( GL_TEXTURE_2D, 0, nv::image_format_to_enum(m_format), m_size.x, m_size.y, 0, nv::image_format_to_enum(m_format), nv::type_to_gl_enum(m_datatype), data );
+	glTexImage2D( GL_TEXTURE_2D, 0, nv::image_format_to_enum(m_format), m_size.x, m_size.y, 0, nv::image_format_to_enum(m_format), nv::datatype_to_gl_enum(m_datatype), data );
 	glBindTexture( GL_TEXTURE_2D, 0 );
 }
Index: /trunk/src/gl/gl_vertex_buffer.cc
===================================================================
--- /trunk/src/gl/gl_vertex_buffer.cc	(revision 69)
+++ /trunk/src/gl/gl_vertex_buffer.cc	(revision 70)
@@ -89,5 +89,5 @@
 			location, 
 			va->get_components(), 
-			nv::type_to_gl_enum( va->get_datatype() ),
+			nv::datatype_to_gl_enum( va->get_datatype() ),
 			GL_FALSE,
 			va->get_stride(),
