Index: trunk/nv/gl/gl_enum.hh
===================================================================
--- trunk/nv/gl/gl_enum.hh	(revision 42)
+++ trunk/nv/gl/gl_enum.hh	(revision 43)
@@ -16,4 +16,5 @@
 #include <nv/interface/render_state.hh>
 #include <nv/interface/vertex_buffer.hh>
+#include <nv/interface/texture2d.hh>
 #include <nv/types.hh>
 
@@ -30,4 +31,8 @@
 	unsigned int stencil_operation_to_enum( stencil_test_face::operation type );
 	unsigned int buffer_hint_to_enum( buffer_hint hint );
+	unsigned int texture_format_to_enum( texture2d::format format );
+	unsigned int texture_datatype_to_enum( texture2d::datatype datatype );
+	unsigned int texture_filter_to_enum( texture2d_sampler::filter filter );
+	unsigned int texture_wrap_to_enum( texture2d_sampler::wrap wrap );
 
 	unsigned int type_to_gl_enum( type type );
Index: trunk/nv/gl/gl_texture2d.hh
===================================================================
--- trunk/nv/gl/gl_texture2d.hh	(revision 43)
+++ trunk/nv/gl/gl_texture2d.hh	(revision 43)
@@ -0,0 +1,35 @@
+// 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_texture2d.hh
+ * @author Kornel Kisielewicz epyon@chaosforge.org
+ * @brief Texture2D class
+ */
+
+#ifndef NV_GL_TEXTURE2D_HH
+#define NV_GL_TEXTURE2D_HH
+
+#include <nv/interface/texture2d.hh>
+#include <nv/gl/gl_names.hh>
+
+namespace nv
+{
+
+	class gl_texture2d : public texture2d
+	{
+	public:
+		gl_texture2d( ivec2 size, format aformat, datatype adatatype, texture2d_sampler sampler, void* data = nullptr );
+		virtual void assign( void* data );
+		virtual void bind( int slot = 0 );
+		virtual void unbind();
+		virtual bool is_valid() const;
+	protected:
+		gl_texture_name m_name;
+	};
+	
+} // namespace nv
+
+#endif // NV_GL_TEXTURE2D_HH
Index: trunk/nv/interface/texture2d.hh
===================================================================
--- trunk/nv/interface/texture2d.hh	(revision 43)
+++ trunk/nv/interface/texture2d.hh	(revision 43)
@@ -0,0 +1,89 @@
+// 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 texture2d.hh
+ * @author Kornel Kisielewicz epyon@chaosforge.org
+ * @brief Texture2D class
+ */
+
+#ifndef NV_TEXTURE2D_HH
+#define NV_TEXTURE2D_HH
+
+#include <nv/common.hh>
+#include <nv/types.hh>
+
+namespace nv
+{
+
+	struct texture2d_sampler
+	{
+		enum filter
+		{
+			LINEAR,
+			NEAREST,
+			NEAREST_MIPMAP_NEAREST,
+			LINEAR_MIPMAP_NEAREST,
+			NEAREST_MIPMAP_LINEAR,
+			LINEAR_MIPMAP_LINEAR
+		};
+		enum wrap
+		{
+			CLAMP_TO_EDGE,
+			CLAMP_TO_BORDER, 
+			MIRRORED_REPEAT, 
+			REPEAT
+		};
+
+		filter filter_min;
+		filter filter_max;
+		wrap wrap_s;
+		wrap wrap_t;
+
+		texture2d_sampler( filter min, filter max, wrap s, wrap t )
+			: filter_min( min ), filter_max( max ), wrap_s( s ), wrap_t( t ) {}
+		texture2d_sampler( filter f, wrap w )
+			: filter_min( f ), filter_max( f ), wrap_s( w ), wrap_t( w ) {}
+
+	};
+
+
+	class texture2d
+	{
+	public:
+		enum format
+		{
+			RGB,
+			RGBA
+		};
+
+		enum datatype
+		{
+			UINT,
+			UBYTE,
+			FLOAT
+		};
+		texture2d( ivec2 size, format aformat, datatype adatatype, texture2d_sampler asampler ) : 
+			m_size( size ), m_format( aformat ), m_datatype( adatatype ), m_sampler( asampler ) {}
+		virtual void assign( void* data ) = 0;
+		virtual void bind( int slot = 0 ) = 0;
+		virtual void unbind() = 0;
+		virtual bool is_valid() const = 0;
+		const ivec2& get_size() const { return m_size; }
+		int get_width() const { return m_size.x; }
+		int get_height() const { return m_size.y; }
+		format get_format() const { return m_format; }
+		datatype get_datatype() const { return m_datatype; }
+		const texture2d_sampler& get_sampler() const { return m_sampler; }
+	protected:
+		ivec2             m_size;
+		format            m_format;
+		datatype          m_datatype;
+		texture2d_sampler m_sampler;
+	};
+
+} // namespace nv
+
+#endif // NV_TEXTURE2D_HH
Index: trunk/src/gl/gl_enum.cc
===================================================================
--- trunk/src/gl/gl_enum.cc	(revision 42)
+++ trunk/src/gl/gl_enum.cc	(revision 43)
@@ -134,4 +134,52 @@
 }
 
+unsigned int nv::texture_format_to_enum( texture2d::format format )
+{
+	switch( format )
+	{
+	case texture2d::RGB  : return GL_RGB;
+	case texture2d::RGBA : return GL_RGBA;
+	default : return 0; // TODO: throw!
+	}
+}
+
+unsigned int nv::texture_datatype_to_enum( texture2d::datatype datatype )
+{
+	switch( datatype )
+	{
+	case texture2d::UINT   : return GL_UNSIGNED_INT;
+	case texture2d::UBYTE  : return GL_UNSIGNED_BYTE;
+	case texture2d::FLOAT  : return GL_FLOAT;
+	default : return 0; // TODO: throw!
+	}
+}
+
+unsigned int nv::texture_filter_to_enum( texture2d_sampler::filter filter )
+{
+	switch( filter )
+	{
+	case texture2d_sampler::LINEAR                 : return GL_LINEAR;
+	case texture2d_sampler::NEAREST                : return GL_NEAREST;
+	case texture2d_sampler::NEAREST_MIPMAP_NEAREST : return GL_NEAREST_MIPMAP_NEAREST;
+	case texture2d_sampler::LINEAR_MIPMAP_NEAREST  : return GL_LINEAR_MIPMAP_NEAREST;
+	case texture2d_sampler::NEAREST_MIPMAP_LINEAR  : return GL_NEAREST_MIPMAP_LINEAR;
+	case texture2d_sampler::LINEAR_MIPMAP_LINEAR   : return GL_LINEAR_MIPMAP_LINEAR;
+	default : return 0; // TODO: throw!
+	}
+}
+
+unsigned int nv::texture_wrap_to_enum( texture2d_sampler::wrap wrap )
+{
+	switch( wrap )
+	{
+	case texture2d_sampler::CLAMP_TO_EDGE   : return GL_CLAMP_TO_EDGE;
+	case texture2d_sampler::CLAMP_TO_BORDER : return GL_CLAMP_TO_BORDER;
+	case texture2d_sampler::MIRRORED_REPEAT : return GL_MIRRORED_REPEAT;
+	case texture2d_sampler::REPEAT          : return GL_REPEAT;
+	default : return 0; // TODO: throw!
+	}
+}
+
+
 unsigned int nv::type_to_gl_enum( type type )
 {
Index: trunk/src/gl/gl_texture2d.cc
===================================================================
--- trunk/src/gl/gl_texture2d.cc	(revision 43)
+++ trunk/src/gl/gl_texture2d.cc	(revision 43)
@@ -0,0 +1,51 @@
+// 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_texture2d.hh"
+
+#include "nv/gl/gl_enum.hh"
+#include "nv/lib/gl.hh"
+
+using namespace nv;
+
+nv::gl_texture2d::gl_texture2d( ivec2 size, format aformat, datatype adatatype, texture2d_sampler sampler, void* data /*= nullptr */ )
+	: texture2d( size, aformat, adatatype, sampler ), m_name()
+{
+	glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
+
+	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nv::texture_filter_to_enum( m_sampler.filter_min ) );
+	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nv::texture_filter_to_enum( m_sampler.filter_max ) );
+	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, nv::texture_wrap_to_enum( m_sampler.wrap_s) );
+	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, nv::texture_wrap_to_enum( m_sampler.wrap_t) );
+
+	glBindTexture( GL_TEXTURE_2D, 0 );
+
+	if (data)
+	{
+		assign(data);
+	}
+}
+
+void nv::gl_texture2d::assign( void* data )
+{
+	glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
+	glTexImage2D( GL_TEXTURE_2D, 0, nv::texture_format_to_enum(m_format), m_size.x, m_size.y, 0, nv::texture_format_to_enum(m_format), nv::texture_datatype_to_enum(m_datatype), data );
+	glBindTexture( GL_TEXTURE_2D, 0 );
+}
+
+void nv::gl_texture2d::bind( int slot )
+{
+	glActiveTexture( GL_TEXTURE0 + slot );
+	glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
+}
+
+void nv::gl_texture2d::unbind()
+{
+	glBindTexture( GL_TEXTURE_2D, 0 );
+}
+
+bool nv::gl_texture2d::is_valid() const
+{
+	return m_name.is_valid();
+}
