Index: trunk/src/gfx/debug_draw.cc
===================================================================
--- trunk/src/gfx/debug_draw.cc	(revision 312)
+++ trunk/src/gfx/debug_draw.cc	(revision 313)
@@ -28,14 +28,14 @@
 	"}\n";
 
-nv::debug_data::debug_data( device* a_device )
-	: m_device( a_device ), m_program(), m_va()
+nv::debug_data::debug_data( context* a_context )
+	: m_context( a_context ), m_program(), m_va()
 {
-	m_program = m_device->create_program( nv_debug_draw_vertex_shader, nv_debug_draw_fragment_shader );
+	m_program = m_context->get_device()->create_program( nv_debug_draw_vertex_shader, nv_debug_draw_fragment_shader );
 }
 
 void nv::debug_data::update()
 {
-	m_device->release( m_va );
-	m_va = m_device->create_vertex_array( m_data, nv::STATIC_DRAW );
+	m_context->release( m_va );
+	m_va = m_context->create_vertex_array( m_data, nv::STATIC_DRAW );
 }
 
@@ -75,5 +75,5 @@
 nv::debug_data::~debug_data()
 {
-	m_device->release( m_va );
-	m_device->release( m_program );
+	m_context->release( m_va );
+	m_context->get_device()->release( m_program );
 }
Index: trunk/src/gfx/keyframed_mesh.cc
===================================================================
--- trunk/src/gfx/keyframed_mesh.cc	(revision 312)
+++ trunk/src/gfx/keyframed_mesh.cc	(revision 313)
@@ -105,5 +105,5 @@
 nv::keyframed_mesh::~keyframed_mesh()
 {
-	m_context->get_device()->release( m_va );
+	m_context->release( m_va );
 }
 
@@ -131,6 +131,6 @@
 	, m_gpu_next_frame( 0xFFFFFFFF )
 {
-	m_va      = a_context->get_device()->create_vertex_array( a_data, STATIC_DRAW );
-	m_pbuffer = a_context->get_device()->find_buffer( m_va, slot::POSITION );
+	m_va      = a_context->create_vertex_array( a_data, STATIC_DRAW );
+	m_pbuffer = a_context->find_buffer( m_va, slot::POSITION );
 }
 
@@ -140,13 +140,12 @@
 	if ( m_loc_next_position == -1 ) return;
 	animated_mesh::update( ms );
-	device* dev = m_context->get_device();
 	if ( m_gpu_last_frame != m_last_frame )
 	{
 		uint32 base_offset = m_last_frame * m_vertex_count * m_vsize; 
-		dev->update_attribute_offset( m_va, slot::POSITION, base_offset );
-		dev->update_attribute_offset( m_va, slot::NORMAL,   base_offset + sizeof( vec3 ) );
+		m_context->update_attribute_offset( m_va, slot::POSITION, base_offset );
+		m_context->update_attribute_offset( m_va, slot::NORMAL,   base_offset + sizeof( vec3 ) );
 		if ( m_has_tangent && m_loc_next_tangent != -1 )
 		{
-			dev->update_attribute_offset( m_va, slot::TANGENT, base_offset + 2*sizeof( vec3 ) );
+			m_context->update_attribute_offset( m_va, slot::TANGENT, base_offset + 2*sizeof( vec3 ) );
 		}
 		m_gpu_last_frame = m_last_frame;
@@ -155,9 +154,9 @@
 	{
 		uint32 base_offset = m_next_frame * m_vertex_count * m_vsize; 
-		dev->update_attribute_offset( m_va, (slot)m_loc_next_position, base_offset );
-		dev->update_attribute_offset( m_va, (slot)m_loc_next_normal, base_offset + sizeof( vec3 ) );
+		m_context->update_attribute_offset( m_va, (slot)m_loc_next_position, base_offset );
+		m_context->update_attribute_offset( m_va, (slot)m_loc_next_normal, base_offset + sizeof( vec3 ) );
 		if ( m_has_tangent && m_loc_next_tangent != -1 )
 		{
-			dev->update_attribute_offset( m_va, (slot)m_loc_next_tangent, base_offset + 2*sizeof( vec3 ) );
+			m_context->update_attribute_offset( m_va, (slot)m_loc_next_tangent, base_offset + 2*sizeof( vec3 ) );
 		}
 		m_gpu_next_frame = m_next_frame;
@@ -175,8 +174,8 @@
 			m_loc_next_tangent  = dev->get_attribute_location( a_program, "nv_next_tangent" );
 
-		dev->add_vertex_buffer( m_va, (slot)m_loc_next_position, m_pbuffer, FLOAT, 3, 0, m_vsize, false );
-		dev->add_vertex_buffer( m_va, (slot)m_loc_next_normal,   m_pbuffer, FLOAT, 3, sizeof( vec3 ), m_vsize, false );
+		m_context->add_vertex_buffer( m_va, (slot)m_loc_next_position, m_pbuffer, FLOAT, 3, 0, m_vsize, false );
+		m_context->add_vertex_buffer( m_va, (slot)m_loc_next_normal,   m_pbuffer, FLOAT, 3, sizeof( vec3 ), m_vsize, false );
 		if ( m_has_tangent )
-			dev->add_vertex_buffer( m_va, (slot)m_loc_next_tangent, m_pbuffer, FLOAT, 4, 2*sizeof( vec3 ), m_vsize, false );
+			m_context->add_vertex_buffer( m_va, (slot)m_loc_next_tangent, m_pbuffer, FLOAT, 4, 2*sizeof( vec3 ), m_vsize, false );
 	}
 	keyframed_mesh::update( a_program );
@@ -186,14 +185,14 @@
 	: keyframed_mesh( a_context, a_data, a_tag_map )
 {
-	m_va      = m_context->get_device()->create_vertex_array();
+	m_va      = m_context->create_vertex_array();
 	m_pbuffer = m_context->get_device()->create_buffer( VERTEX_BUFFER, STATIC_DRAW, m_vertex_count * m_vsize, (void*)m_vchannel->data );
-	m_context->get_device()->add_vertex_buffers( m_va, m_pbuffer, m_vchannel );
+	m_context->add_vertex_buffers( m_va, m_pbuffer, m_vchannel );
 
 	buffer  vb = m_context->get_device()->create_buffer( VERTEX_BUFFER, STATIC_DRAW, m_vertex_count * sizeof( vec2 ), (void*)m_mesh_data->get_channel<vertex_t>()->data );
-	m_context->get_device()->add_vertex_buffers( m_va, vb, m_mesh_data->get_channel<vertex_t>() );
+	m_context->add_vertex_buffers( m_va, vb, m_mesh_data->get_channel<vertex_t>() );
 
 	buffer  ib = m_context->get_device()->create_buffer( INDEX_BUFFER, STATIC_DRAW, m_mesh_data->get_index_channel()->size(), (void*)m_mesh_data->get_index_channel()->data );
 
-	m_context->get_device()->set_index_buffer( m_va, ib, m_mesh_data->get_index_channel()->desc.slots[0].etype, true );
+	m_context->set_index_buffer( m_va, ib, m_mesh_data->get_index_channel()->desc.slots[0].etype, true );
 
 	m_data = new uint8[ m_vertex_count * m_vsize ];
Index: trunk/src/gfx/particle_engine.cc
===================================================================
--- trunk/src/gfx/particle_engine.cc	(revision 312)
+++ trunk/src/gfx/particle_engine.cc	(revision 313)
@@ -485,7 +485,7 @@
 	info->particles = new particle[ data->quota ];
 	info->quads     = new particle_quad[ data->quota ];
-	info->vtx_array = m_device->create_vertex_array<particle_vtx>( 
+	info->vtx_array = m_context->create_vertex_array<particle_vtx>( 
 		(particle_vtx*)info->quads, data->quota*6, STREAM_DRAW );
-	info->vtx_buffer = m_device->find_buffer( info->vtx_array, slot::POSITION );
+	info->vtx_buffer = m_context->find_buffer( info->vtx_array, slot::POSITION );
 	info->last_update = 0;
 	info->test = false;
@@ -519,5 +519,5 @@
 		delete[] info->quads;
 		//if ( system->own_va ) 
-		m_device->release( info->vtx_array );
+		m_context->release( info->vtx_array );
 		m_systems.destroy( system );
 	}
Index: trunk/src/gfx/skeletal_mesh.cc
===================================================================
--- trunk/src/gfx/skeletal_mesh.cc	(revision 312)
+++ trunk/src/gfx/skeletal_mesh.cc	(revision 313)
@@ -26,7 +26,7 @@
 	m_vtx_data  = a_mesh_data->get_channel_data<md5_vtx_pntiw>();
 	m_indices   = a_mesh_data->get_count();
-	m_va        = a_context->get_device()->create_vertex_array( a_mesh_data, 
+	m_va        = a_context->create_vertex_array( a_mesh_data, 
 STREAM_DRAW );
-	m_pbuffer   = a_context->get_device()->find_buffer( m_va, slot::POSITION );
+	m_pbuffer   = a_context->find_buffer( m_va, slot::POSITION );
 }
 
@@ -195,5 +195,5 @@
 	: skeletal_mesh( a_context ), m_bone_data( a_bone_data ), m_transform( nullptr )
 {
-	m_va          = a_context->get_device()->create_vertex_array( a_mesh, nv::STATIC_DRAW );
+	m_va          = a_context->create_vertex_array( a_mesh, nv::STATIC_DRAW );
 	m_index_count = a_mesh->get_count();
 	if ( m_bone_data )
