Index: trunk/tests/render_test/nv_render_test.cc
===================================================================
--- trunk/tests/render_test/rl.cc	(revision 239)
+++ trunk/tests/render_test/nv_render_test.cc	(revision 321)
@@ -1,13 +1,10 @@
-#include <nv/interface/vertex_buffer.hh>
 #include <nv/gl/gl_device.hh>
 #include <nv/gfx/image.hh>
 #include <nv/interface/context.hh>
 #include <nv/interface/window.hh>
-#include <nv/interface/program.hh>
-#include <nv/interface/texture2d.hh>
-#include <nv/logging.hh>
-#include <nv/logger.hh>
-#include <nv/math.hh>
-#include <nv/string.hh>
+#include <nv/core/logging.hh>
+#include <nv/core/logger.hh>
+#include <nv/core/math.hh>
+#include <nv/core/string.hh>
 
 const nv::uint16 size_x  = 16;
@@ -63,7 +60,8 @@
 	~application();
 protected:
-	nv::device* m_device;
-	nv::window* m_window;
-	nv::texture2d* m_texture;
+	nv::device*  m_device;
+	nv::context* m_context;
+	nv::window*  m_window;
+	nv::texture  m_texture;
 
 	nv::clear_state  m_clear_state;
@@ -71,8 +69,8 @@
 	nv::scene_state  m_scene_state;
 
-	nv::program* m_char_program;
-	nv::program* m_box_program;
-	nv::vertex_array* m_char_va;
-	nv::vertex_array* m_box_va;
+	nv::program m_char_program;
+	nv::program m_box_program;
+	nv::vertex_array m_char_va;
+	nv::vertex_array m_box_va;
 	unsigned int m_count;
 };
@@ -89,10 +87,11 @@
 application::application()
 {
-	m_device = new nv::gl_device();
-	m_window = m_device->create_window( 800, 600, false );
+	m_device  = new nv::gl_device();
+	m_window  = m_device->create_window( 800, 600, false );
+	m_context = m_window->get_context();
 	
 	nv::image_data* sprites = m_device->create_image_data( "spritesheet.png" );
 	nv::sampler sampler( nv::sampler::NEAREST, nv::sampler::REPEAT );
-	m_texture = m_device->create_texture2d( sprites->get_size(), nv::RGBA, nv::UBYTE, sampler, (void*)sprites->get_data() );
+	m_texture = m_device->create_texture( sprites, sampler );
 	delete sprites;
 
@@ -119,5 +118,5 @@
 		v.emplace_back( nv::i8vec3( x,   h, y ), mt );  
 		m_char_program = m_device->create_program( nv::slurp( "char.vert" ), nv::slurp( "char.frag" ) );
-		m_char_va      = m_device->create_vertex_array( v, nv::STATIC_DRAW );
+		m_char_va      = m_context->create_vertex_array( v, nv::STATIC_DRAW );
 	}
 
@@ -176,5 +175,5 @@
 		m_count       = v.size();
 		m_box_program = m_device->create_program( nv::slurp( "box.vert" ), nv::slurp( "box.frag" ) );
-		m_box_va      = m_device->create_vertex_array( v, nv::STATIC_DRAW );
+		m_box_va      = m_context->create_vertex_array( v, nv::STATIC_DRAW );
 	}
 
@@ -194,11 +193,11 @@
 		m_scene_state.get_camera().set_lookat(glm::vec3(0.0, 20.0, 5.0) + move, glm::vec3(0.0, 4.0, 0.0) + move, glm::vec3(0.0, 1.0, 0.0));
 
-		m_window->get_context()->clear( m_clear_state );
-		m_texture->bind( 0 );
-		m_box_program->set_uniform( "light", glm::vec3(8.5, 4.5, 6.5) + move );
-		m_window->get_context()->draw( nv::TRIANGLES, m_render_state, m_scene_state, m_box_program, m_box_va, m_count );
-
-		m_char_program->set_uniform( "pos", move + glm::vec3( 8, 4.1, 6 ) );
-		m_window->get_context()->draw( nv::TRIANGLES, m_render_state, m_scene_state, m_char_program, m_char_va, 6 );
+		m_context->clear( m_clear_state );
+		m_context->bind( m_texture, nv::TEXTURE_0 );
+		m_device->set_uniform( m_box_program, "light", glm::vec3(8.5, 4.5, 6.5) + move );
+		m_context->draw( nv::TRIANGLES, m_render_state, m_scene_state, m_box_program, m_box_va, m_count );
+
+		m_device->set_uniform( m_char_program, "pos", move + glm::vec3( 8, 4.1, 6 ) );
+		m_context->draw( nv::TRIANGLES, m_render_state, m_scene_state, m_char_program, m_char_va, 6 );
 		m_window->swap_buffers();
 
@@ -234,9 +233,9 @@
 application::~application()
 {
-	delete m_char_program;
-	delete m_box_program;
-	delete m_char_va;
-	delete m_box_va;
-	delete m_texture;
+	m_device->release( m_char_program );
+	m_device->release( m_box_program );
+	m_context->release( m_char_va );
+	m_context->release( m_box_va );
+	m_device->release( m_texture );
 	delete m_window;
 	delete m_device;
