Index: unk/nv/gl/gl_names.hh
===================================================================
--- /trunk/nv/gl/gl_names.hh	(revision 299)
+++ 	(revision )
@@ -1,53 +1,0 @@
-// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
-// http://chaosforge.org/
-//
-// This file is part of NV Libraries.
-// For conditions of distribution and use, see copyright notice in nv.hh
-/**
- * @file gl_names.hh
- * @author Kornel Kisielewicz epyon@chaosforge.org
- * @brief GL name clasess
- */
-
-#ifndef NV_GL_NAMES_HH
-#define NV_GL_NAMES_HH
-
-#include <nv/common.hh>
-
-namespace nv
-{
-
-	class gl_name
-	{
-	public:
-		gl_name() : m_value( 0 ) {}
-		unsigned get_value() const { return m_value; }
-		bool is_valid() const { return m_value != 0; }
-	protected:
-		unsigned m_value;
-	};
-
-	class gl_texture_name : public gl_name
-	{
-	public:
-		gl_texture_name();
-		~gl_texture_name();
-	};
-
-	class gl_shader_name : public gl_name
-	{
-	public:
-		gl_shader_name();
-		~gl_shader_name();
-	};
-
-	class gl_buffer_name : public gl_name
-	{
-	public:
-		gl_buffer_name();
-		~gl_buffer_name();
-	};
-
-}
-
-#endif // NV_GL_NAMES_HH
Index: /trunk/nv/gl/gl_program.hh
===================================================================
--- /trunk/nv/gl/gl_program.hh	(revision 299)
+++ /trunk/nv/gl/gl_program.hh	(revision 300)
@@ -16,5 +16,4 @@
 #include <nv/interface/program.hh>
 #include <nv/string.hh>
-#include <nv/gl/gl_names.hh>
 
 namespace nv
@@ -37,6 +36,6 @@
 		unsigned int get_id() const	{ return object_id;	}
 	private:
-		uint32 shader_type;
-		uint32 object_id;
+		uint32   shader_type;
+		unsigned object_id;
 	};
 
@@ -58,5 +57,5 @@
 		void load_uniforms();
 
-		gl_shader_name m_name;
+		unsigned  glid;
 		gl_shader vertex_shader;
 		gl_shader fragment_shader;
Index: /trunk/nv/gl/gl_texture2d.hh
===================================================================
--- /trunk/nv/gl/gl_texture2d.hh	(revision 299)
+++ /trunk/nv/gl/gl_texture2d.hh	(revision 300)
@@ -14,5 +14,4 @@
 
 #include <nv/interface/texture2d.hh>
-#include <nv/gl/gl_names.hh>
 
 namespace nv
@@ -25,6 +24,7 @@
 
 		gl_texture2d( ivec2 size, pixel_format aformat, datatype adatatype, sampler asampler, void* data = nullptr );
+		~gl_texture2d();
 	protected:
-		gl_texture_name m_name;
+		unsigned glid;
 	};
 	
Index: /trunk/nv/gl/gl_vertex_buffer.hh
===================================================================
--- /trunk/nv/gl/gl_vertex_buffer.hh	(revision 299)
+++ /trunk/nv/gl/gl_vertex_buffer.hh	(revision 300)
@@ -14,5 +14,4 @@
 
 #include <nv/interface/vertex_buffer.hh>
-#include <nv/gl/gl_names.hh>
 
 namespace nv
@@ -25,6 +24,7 @@
 
 		gl_vertex_buffer( buffer_hint hint, size_t size, const void* data = nullptr );
+		~gl_vertex_buffer();
 	private:
-		gl_buffer_name m_name;
+		unsigned glid;
 	};
 
@@ -35,6 +35,7 @@
 
 		gl_index_buffer( buffer_hint hint, size_t size, const void* data = nullptr );
+		~gl_index_buffer();
 	private:
-		gl_buffer_name m_name;
+		unsigned glid;
 	};
 
Index: /trunk/src/gl/gl_context.cc
===================================================================
--- /trunk/src/gl/gl_context.cc	(revision 299)
+++ /trunk/src/gl/gl_context.cc	(revision 300)
@@ -16,5 +16,5 @@
 void gl_context::bind( texture2d* texture, texture_slot slot )
 {
-	GLuint id = static_cast< gl_texture2d* >( texture )->m_name.get_value();
+	GLuint id = static_cast< gl_texture2d* >( texture )->glid;
 	glActiveTexture( GL_TEXTURE0 + static_cast< GLenum >( slot ) );
 	glBindTexture( GL_TEXTURE_2D, id );
@@ -24,5 +24,5 @@
 {
 	gl_program* glp = static_cast< gl_program* >( p );
-	glUseProgram( glp->m_name.get_value() );
+	glUseProgram( glp->glid );
 	glp->update_uniforms();
 }
@@ -30,5 +30,5 @@
 void nv::gl_context::bind( vertex_buffer* b )
 {
-	GLuint id = static_cast< gl_vertex_buffer* >( b )->m_name.get_value();
+	GLuint id = static_cast< gl_vertex_buffer* >( b )->glid;
 	glBindBuffer( GL_ARRAY_BUFFER, id );
 }
@@ -36,5 +36,5 @@
 void nv::gl_context::bind( index_buffer* b )
 {
-	GLuint id = static_cast< gl_index_buffer* >( b )->m_name.get_value();
+	GLuint id = static_cast< gl_index_buffer* >( b )->glid;
 	glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, id );
 }
@@ -96,5 +96,5 @@
 void gl_context::update( texture2d* texture, void* data )
 {
-	GLuint id = static_cast< gl_texture2d* >( texture )->m_name.get_value();
+	GLuint id = static_cast< gl_texture2d* >( texture )->glid;
 	image_format format = texture->get_format();
 	ivec2        size   = texture->get_size();
Index: unk/src/gl/gl_names.cc
===================================================================
--- /trunk/src/gl/gl_names.cc	(revision 299)
+++ 	(revision )
@@ -1,48 +1,0 @@
-// Copyright (C) 2012-2013 Kornel Kisielewicz
-// This file is part of NV Libraries.
-// For conditions of distribution and use, see copyright notice in nv.hh
-
-#include "nv/gl/gl_names.hh"
-
-#include "nv/lib/gl.hh"
-
-using namespace nv;
-
-gl_texture_name::gl_texture_name()
-{
-	glGenTextures( 1, &m_value );
-}
-
-gl_texture_name::~gl_texture_name()
-{
-	if ( m_value != 0 )
-	{
-		glDeleteTextures( 1, &m_value );
-	}
-}
-
-gl_shader_name::gl_shader_name()
-{
-	m_value = glCreateProgram();
-}
-
-gl_shader_name::~gl_shader_name()
-{
-	if ( m_value != 0 )
-	{
-		glDeleteProgram( m_value );
-	}
-}
-
-gl_buffer_name::gl_buffer_name()
-{
-	glGenBuffers( 1, &m_value );
-}
-
-gl_buffer_name::~gl_buffer_name()
-{
-	if ( m_value != 0 )
-	{
-		glDeleteBuffers( 1, &m_value );
-	}
-}
Index: /trunk/src/gl/gl_program.cc
===================================================================
--- /trunk/src/gl/gl_program.cc	(revision 299)
+++ /trunk/src/gl/gl_program.cc	(revision 300)
@@ -88,4 +88,5 @@
 	: vertex_shader( GL_VERTEX_SHADER ), fragment_shader( GL_FRAGMENT_SHADER )
 {
+	glid = glCreateProgram();
 	compile( vertex_program, fragment_program );
 }
@@ -93,9 +94,10 @@
 gl_program::~gl_program()
 {
-	if ( is_valid() )
+	if ( glid != 0 )
 	{
 		// Detach the shaders from the program
-		glDetachShader( m_name.get_value(), vertex_shader.get_id() );
-		glDetachShader( m_name.get_value(), fragment_shader.get_id() );
+		glDetachShader( glid, vertex_shader.get_id() );
+		glDetachShader( glid, fragment_shader.get_id() );
+		glDeleteProgram( glid );
 	}
 }
@@ -106,15 +108,15 @@
 	if (!fragment_shader.compile( fragment_program )) { return false; }
 
-	glBindAttribLocation( m_name.get_value(), static_cast<GLuint>( slot::POSITION   ), "nv_position"  );
-	glBindAttribLocation( m_name.get_value(), static_cast<GLuint>( slot::TEXCOORD   ), "nv_texcoord"  );
-	glBindAttribLocation( m_name.get_value(), static_cast<GLuint>( slot::NORMAL     ), "nv_normal"    );
-	glBindAttribLocation( m_name.get_value(), static_cast<GLuint>( slot::COLOR      ), "nv_color"     );
-	glBindAttribLocation( m_name.get_value(), static_cast<GLuint>( slot::TANGENT    ), "nv_tangent"   );
-	glBindAttribLocation( m_name.get_value(), static_cast<GLuint>( slot::BONEINDEX  ), "nv_boneindex" );
-	glBindAttribLocation( m_name.get_value(), static_cast<GLuint>( slot::BONEWEIGHT ), "nv_boneweight");
-
-	glAttachShader( m_name.get_value(), fragment_shader.get_id() );
-	glAttachShader( m_name.get_value(), vertex_shader.get_id() );
-	glLinkProgram( m_name.get_value() );
+	glBindAttribLocation( glid, static_cast<GLuint>( slot::POSITION   ), "nv_position"  );
+	glBindAttribLocation( glid, static_cast<GLuint>( slot::TEXCOORD   ), "nv_texcoord"  );
+	glBindAttribLocation( glid, static_cast<GLuint>( slot::NORMAL     ), "nv_normal"    );
+	glBindAttribLocation( glid, static_cast<GLuint>( slot::COLOR      ), "nv_color"     );
+	glBindAttribLocation( glid, static_cast<GLuint>( slot::TANGENT    ), "nv_tangent"   );
+	glBindAttribLocation( glid, static_cast<GLuint>( slot::BONEINDEX  ), "nv_boneindex" );
+	glBindAttribLocation( glid, static_cast<GLuint>( slot::BONEWEIGHT ), "nv_boneweight");
+
+	glAttachShader( glid, fragment_shader.get_id() );
+	glAttachShader( glid, vertex_shader.get_id() );
+	glLinkProgram( glid );
 
 	if (!validate())
@@ -129,5 +131,5 @@
 bool gl_program::is_valid() const
 {
-	return m_name.is_valid();
+	return glid != 0;
 }
 
@@ -135,5 +137,5 @@
 {
 	int params;
-	glGetProgramiv( m_name.get_value(), GL_ACTIVE_ATTRIBUTES, &params );
+	glGetProgramiv( glid, GL_ACTIVE_ATTRIBUTES, &params );
 
 	for ( unsigned i = 0; i < (unsigned)params; ++i )
@@ -144,5 +146,5 @@
 		char name_buffer[128];
 
-		glGetActiveAttrib( m_name.get_value(), i, 128, &attr_nlen, &attr_len, &attr_type, name_buffer );
+		glGetActiveAttrib( glid, i, 128, &attr_nlen, &attr_len, &attr_type, name_buffer );
 
 		string name( name_buffer, size_t(attr_nlen) );
@@ -151,5 +153,5 @@
 		if ( name.substr(0,3) == "gl_" ) continue;
 
-		int attr_loc = glGetAttribLocation( m_name.get_value(), name.c_str() );
+		int attr_loc = glGetAttribLocation( glid, name.c_str() );
 
 		m_attribute_map[ name ] = new attribute( name, attr_loc, gl_enum_to_datatype( attr_type ), attr_len );
@@ -160,5 +162,5 @@
 {
 	int params;
-	glGetProgramiv( m_name.get_value(), GL_ACTIVE_UNIFORMS, &params );
+	glGetProgramiv( glid, GL_ACTIVE_UNIFORMS, &params );
 
 	for ( unsigned i = 0; i < size_t(params); ++i )
@@ -169,5 +171,5 @@
 		char name_buffer[128];
 
-		glGetActiveUniform( m_name.get_value(), i, 128, &uni_nlen, &uni_len, &uni_type, name_buffer );
+		glGetActiveUniform( glid, i, 128, &uni_nlen, &uni_len, &uni_type, name_buffer );
 
 		string name( name_buffer, size_t(uni_nlen) );
@@ -176,5 +178,5 @@
 		if ( name.substr(0,3) == "gl_" ) continue;
 
-		int uni_loc = glGetUniformLocation( m_name.get_value(), name.c_str() );
+		int uni_loc = glGetUniformLocation( glid, name.c_str() );
 		datatype utype = gl_enum_to_datatype( uni_type );
 		
@@ -232,12 +234,12 @@
 	int status;
 
-	glGetProgramiv( m_name.get_value(), GL_LINK_STATUS, &status );
-	glGetProgramInfoLog( m_name.get_value(), buffer_size, &length, buffer );
-
-	NV_LOG( LOG_INFO, "Program #" << m_name.get_value() << (status == GL_FALSE ? " failed to compile!" : " compiled successfully.") );
+	glGetProgramiv( glid, GL_LINK_STATUS, &status );
+	glGetProgramInfoLog( glid, buffer_size, &length, buffer );
+
+	NV_LOG( LOG_INFO, "Program #" << glid << (status == GL_FALSE ? " failed to compile!" : " compiled successfully.") );
 
 	if ( length > 0 )
 	{
-		NV_LOG( LOG_INFO, "Program #" << m_name.get_value() << " log: " << buffer );
+		NV_LOG( LOG_INFO, "Program #" << glid << " log: " << buffer );
 	}
 
@@ -247,11 +249,11 @@
 	}
 
-	glValidateProgram( m_name.get_value() );
-	glGetProgramiv( m_name.get_value(), GL_VALIDATE_STATUS, &status );
+	glValidateProgram( glid );
+	glGetProgramiv( glid, GL_VALIDATE_STATUS, &status );
 
 	if ( status == GL_FALSE )
 	{
-		glGetProgramInfoLog( m_name.get_value(), buffer_size, &length, buffer );
-		NV_LOG( LOG_ERROR, "Program #" << m_name.get_value() << " validation error : " << buffer );
+		glGetProgramInfoLog( glid, buffer_size, &length, buffer );
+		NV_LOG( LOG_ERROR, "Program #" << glid << " validation error : " << buffer );
 		return false;
 	}
Index: /trunk/src/gl/gl_texture2d.cc
===================================================================
--- /trunk/src/gl/gl_texture2d.cc	(revision 299)
+++ /trunk/src/gl/gl_texture2d.cc	(revision 300)
@@ -11,7 +11,9 @@
 
 nv::gl_texture2d::gl_texture2d( ivec2 size, pixel_format aformat, datatype adatatype, sampler asampler, void* data /*= nullptr */ )
-	: texture2d( size, aformat, adatatype, asampler ), m_name()
+	: texture2d( size, aformat, adatatype, asampler )
 {
-	glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
+	glGenTextures( 1, &glid );
+
+	glBindTexture( GL_TEXTURE_2D, glid );
 
 	// Detect if mipmapping was requested
@@ -27,11 +29,17 @@
 	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (int)nv::sampler_wrap_to_enum( m_sampler.wrap_t) );
 
-	glBindTexture( GL_TEXTURE_2D, 0 );
-
 	if (data)
 	{
-		glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
 		glTexImage2D( GL_TEXTURE_2D, 0, (GLint)nv::image_format_to_enum(m_format.format), m_size.x, m_size.y, 0, nv::image_format_to_enum(m_format.format), nv::datatype_to_gl_enum(m_format.type), data );
-		glBindTexture( GL_TEXTURE_2D, 0 );
+	}
+
+	glBindTexture( GL_TEXTURE_2D, 0 );
+}
+
+nv::gl_texture2d::~gl_texture2d()
+{
+	if ( glid != 0 )
+	{
+		glDeleteTextures( 1, &glid );
 	}
 }
Index: /trunk/src/gl/gl_vertex_buffer.cc
===================================================================
--- /trunk/src/gl/gl_vertex_buffer.cc	(revision 299)
+++ /trunk/src/gl/gl_vertex_buffer.cc	(revision 300)
@@ -11,17 +11,35 @@
 
 gl_vertex_buffer::gl_vertex_buffer( buffer_hint hint, size_t size, const void* data ) 
-	: vertex_buffer( hint, size ), m_name()
+	: vertex_buffer( hint, size )
 {
-	glBindBuffer( GL_ARRAY_BUFFER, m_name.get_value() );
+	glGenBuffers( 1, &glid );
+	glBindBuffer( GL_ARRAY_BUFFER, glid );
 	glBufferData( GL_ARRAY_BUFFER, (GLsizeiptr)m_size, data, buffer_hint_to_enum( m_hint ) );
 	glBindBuffer( GL_ARRAY_BUFFER, 0 );
 }
 
+nv::gl_vertex_buffer::~gl_vertex_buffer()
+{
+	if ( glid != 0 )
+	{
+		glDeleteBuffers( 1, &glid );
+	}
+}
+
 gl_index_buffer::gl_index_buffer( buffer_hint hint, size_t size, const void* data ) 
-	: index_buffer( hint, size ), m_name()
+	: index_buffer( hint, size )
 {
-	glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, m_name.get_value() );
+	glGenBuffers( 1, &glid );
+
+	glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, glid );
 	glBufferData( GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)m_size, data, buffer_hint_to_enum( m_hint ) );
 	glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 );
 }
 
+nv::gl_index_buffer::~gl_index_buffer()
+{
+	if ( glid != 0 )
+	{
+		glDeleteBuffers( 1, &glid );
+	}
+}
