Index: trunk/nv/gl/gl_enum.hh
===================================================================
--- trunk/nv/gl/gl_enum.hh	(revision 35)
+++ trunk/nv/gl/gl_enum.hh	(revision 35)
@@ -0,0 +1,36 @@
+// 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_enum.hh
+ * @author Kornel Kisielewicz epyon@chaosforge.org
+ * @brief GL enumerations
+ */
+
+#ifndef NV_GL_ENUM_HH
+#define NV_GL_ENUM_HH
+
+#include <nv/interface/clear_state.hh>
+#include <nv/interface/render_state.hh>
+#include <nv/types.hh>
+
+namespace nv
+{
+
+	unsigned int clear_state_buffers_to_mask( clear_state::buffers_type type );
+	unsigned int depth_state_function_to_enum( depth_test::function_type type );
+	unsigned int blending_factor_to_enum( blending::factor type );
+	unsigned int blending_equation_to_enum( blending::equation type );
+	unsigned int culling_face_type_to_enum( culling::face_type type );
+	unsigned int culling_order_type_to_enum( culling::order_type type );
+	unsigned int stencil_function_to_enum( stencil_test_face::function_type type );
+	unsigned int stencil_operation_to_enum( stencil_test_face::operation type );
+
+	unsigned int type_to_gl_enum( type type );
+	type gl_enum_to_type( unsigned int gl_enum );
+
+} // namespace nv
+
+#endif // NV_GL_ENUM_HH
Index: trunk/nv/gl/gl_names.hh
===================================================================
--- trunk/nv/gl/gl_names.hh	(revision 35)
+++ trunk/nv/gl/gl_names.hh	(revision 35)
@@ -0,0 +1,53 @@
+// 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 ) {};
+		int 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/lib/gl.hh
===================================================================
--- trunk/nv/lib/gl.hh	(revision 34)
+++ trunk/nv/lib/gl.hh	(revision 35)
@@ -70,4 +70,5 @@
 #define GL_STENCIL_BUFFER_BIT 0x00000400
 #define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_ZERO 0
 #define GL_FALSE 0
 #define GL_TRUE 1
@@ -81,4 +82,5 @@
 #define GL_NEVER 0x0200
 #define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
 #define GL_LEQUAL 0x0203
 #define GL_GREATER 0x0204
@@ -109,4 +111,6 @@
 #define GL_INVALID_OPERATION 0x0502
 #define GL_OUT_OF_MEMORY 0x0505
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
 #define GL_POINT_SIZE 0x0B11
 #define GL_POINT_SIZE_RANGE 0x0B12
@@ -289,4 +293,13 @@
 #define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
 #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_FUNC_ADD 0x8006
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
 
 /* OpenGL 1.3 non-deprecated defines */
Index: trunk/src/gl/gl_enum.cc
===================================================================
--- trunk/src/gl/gl_enum.cc	(revision 35)
+++ trunk/src/gl/gl_enum.cc	(revision 35)
@@ -0,0 +1,161 @@
+// Copyright (C) 2011 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_enum.hh"
+
+#include "nv/lib/gl.hh"
+
+using namespace nv;
+
+unsigned int clear_state_buffers_to_mask( clear_state::buffers_type type )
+{
+	unsigned int mask = 0;
+	if ( (type & clear_state::COLOR_BUFFER) != 0 )   mask |= GL_COLOR_BUFFER_BIT;
+	if ( (type & clear_state::DEPTH_BUFFER) != 0 )   mask |= GL_DEPTH_BUFFER_BIT;
+	if ( (type & clear_state::STENCIL_BUFFER) != 0 ) mask |= GL_STENCIL_BUFFER_BIT;
+	return mask;
+}
+
+unsigned int depth_state_function_to_enum( depth_test::function_type type )
+{
+	switch( type )
+	{
+	case depth_test::NEVER            : return GL_NEVER;
+	case depth_test::LESS             : return GL_LESS;
+	case depth_test::EQUAL            : return GL_EQUAL;
+	case depth_test::LESS_OR_EQUAL    : return GL_LEQUAL;
+	case depth_test::GREATER          : return GL_GREATER;
+	case depth_test::NOT_EQUAL        : return GL_NOTEQUAL;
+	case depth_test::GREATER_OR_EQUAL : return GL_GEQUAL;
+	case depth_test::ALWAYS           : return GL_ALWAYS;
+	default : return 0; // TODO: throw!
+	}
+}
+
+unsigned int blending_factor_to_enum( blending::factor type )
+{
+	switch( type )
+	{
+	case blending::ZERO                    : return GL_ZERO;
+	case blending::ONE                     : return GL_ONE;
+	case blending::SRC_COLOR               : return GL_SRC_COLOR;
+	case blending::ONE_MINUS_SRC_COLOR     : return GL_ONE_MINUS_SRC_COLOR;
+	case blending::DST_COLOR               : return GL_DST_COLOR;
+	case blending::ONE_MINUS_DST_COLOR     : return GL_ONE_MINUS_DST_COLOR;
+	case blending::SRC_ALPHA               : return GL_SRC_ALPHA;
+	case blending::ONE_MINUS_SRC_ALPHA     : return GL_ONE_MINUS_SRC_ALPHA;
+	case blending::DST_ALPHA               : return GL_DST_ALPHA;
+	case blending::ONE_MINUS_DST_ALPHA     : return GL_ONE_MINUS_DST_ALPHA;
+	case blending::CONSTANT_COLOR          : return GL_CONSTANT_COLOR;
+	case blending::ONE_MINUS_CONSTANT_COLOR: return GL_ONE_MINUS_CONSTANT_COLOR;
+	case blending::CONSTANT_ALPHA          : return GL_CONSTANT_ALPHA;
+	case blending::ONE_MINUS_CONSTANT_ALPHA: return GL_ONE_MINUS_CONSTANT_ALPHA;
+	case blending::SRC_ALPHA_SATURATE      : return GL_SRC_ALPHA_SATURATE;
+	default : return 0; // TODO: throw!
+	}
+}
+
+unsigned int blending_equation_to_enum( blending::equation type )
+{
+	switch( type )
+	{
+	case blending::ADD              : return GL_FUNC_ADD;
+	case blending::SUBTRACT         : return GL_FUNC_SUBTRACT;
+	case blending::REVERSE_SUBTRACT : return GL_FUNC_REVERSE_SUBTRACT;
+	case blending::MINIMUM          : return GL_MIN;
+	case blending::MAXIMUM          : return GL_MAX;
+	default : return 0; // TODO: throw!
+	}
+}
+
+unsigned int culling_face_type_to_enum( culling::face_type type )
+{
+	switch( type )
+	{
+	case culling::FRONT          : return GL_FRONT;
+	case culling::BACK           : return GL_BACK;
+	case culling::FRONT_AND_BACK : return GL_FRONT_AND_BACK;
+	default : return 0; // TODO: throw!
+	}
+}
+
+unsigned int culling_order_type_to_enum( culling::order_type type )
+{
+	switch( type )
+	{
+	case culling::CW   : return GL_CW;
+	case culling::CCW  : return GL_CCW;
+	default : return 0; // TODO: throw!
+	}
+}
+
+unsigned int stencil_function_to_enum( stencil_test_face::function_type type )
+{
+	switch( type )
+	{
+	case stencil_test_face::NEVER            : return GL_NEVER;
+	case stencil_test_face::LESS             : return GL_LESS;
+	case stencil_test_face::EQUAL            : return GL_EQUAL;
+	case stencil_test_face::LESS_OR_EQUAL    : return GL_LEQUAL;
+	case stencil_test_face::GREATER          : return GL_GREATER;
+	case stencil_test_face::NOT_EQUAL        : return GL_NOTEQUAL;
+	case stencil_test_face::GREATER_OR_EQUAL : return GL_GEQUAL;
+	case stencil_test_face::ALWAYS           : return GL_ALWAYS;
+	default : return 0; // TODO: throw!
+	}
+}
+
+unsigned int stencil_operation_to_enum( stencil_test_face::operation type )
+{
+	switch( type )
+	{
+	case stencil_test_face::ZERO             : return GL_ZERO;
+	case stencil_test_face::INVERT           : return GL_INVERT;
+	case stencil_test_face::KEEP             : return GL_KEEP;
+	case stencil_test_face::REPLACE          : return GL_REPLACE;
+	case stencil_test_face::INCREMENT        : return GL_INCR;
+	case stencil_test_face::DECREMENT        : return GL_DECR;
+	case stencil_test_face::INCREMENT_WRAP   : return GL_INCR_WRAP;
+	case stencil_test_face::DECREMENT_WRAP   : return GL_DECR_WRAP;
+	default : return 0; // TODO: throw!
+	}
+}
+
+unsigned int type_to_gl_enum( type type )
+{
+	switch( type )
+	{
+	case FLOAT          : return GL_FLOAT;
+	case FLOAT_VECTOR_2 : return GL_FLOAT_VEC2;
+	case FLOAT_VECTOR_3 : return GL_FLOAT_VEC3;
+	case FLOAT_VECTOR_4 : return GL_FLOAT_VEC4;
+	case FLOAT_MATRIX_2 : return GL_FLOAT_MAT2;
+	case FLOAT_MATRIX_3 : return GL_FLOAT_MAT3;
+	case FLOAT_MATRIX_4 : return GL_FLOAT_MAT4;
+	case INT            : return GL_INT;
+	case INT_VECTOR_2   : return GL_INT_VEC2;
+	case INT_VECTOR_3   : return GL_INT_VEC3;
+	case INT_VECTOR_4   : return GL_INT_VEC4;
+	default : return 0; // TODO: throw!
+	}
+}
+
+nv::type gl_enum_to_type( unsigned int gl_enum )
+{
+	switch( gl_enum )
+	{
+	case GL_FLOAT      : return FLOAT;
+	case GL_FLOAT_VEC2 : return FLOAT_VECTOR_2;
+	case GL_FLOAT_VEC3 : return FLOAT_VECTOR_3;
+	case GL_FLOAT_VEC4 : return FLOAT_VECTOR_4;
+	case GL_FLOAT_MAT2 : return FLOAT_MATRIX_2;
+	case GL_FLOAT_MAT3 : return FLOAT_MATRIX_3;
+	case GL_FLOAT_MAT4 : return FLOAT_MATRIX_4;
+	case GL_INT        : return INT;
+	case GL_INT_VEC2   : return INT_VECTOR_2;
+	case GL_INT_VEC3   : return INT_VECTOR_3;
+	case GL_INT_VEC4   : return INT_VECTOR_4;
+	default : return type(0); // TODO: throw!
+	}
+}
Index: trunk/src/gl/gl_names.cc
===================================================================
--- trunk/src/gl/gl_names.cc	(revision 35)
+++ trunk/src/gl/gl_names.cc	(revision 35)
@@ -0,0 +1,48 @@
+// Copyright (C) 2012 Kornel Kisielewicz
+// This file is part of NOVA Libraries.
+// For conditions of distribution and use, see copyright notice in nova.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 );
+	}
+}
