Index: trunk/src/gfx/keyframed_mesh.cc
===================================================================
--- trunk/src/gfx/keyframed_mesh.cc	(revision 295)
+++ trunk/src/gfx/keyframed_mesh.cc	(revision 296)
@@ -98,5 +98,5 @@
 
 
-void nv::keyframed_mesh::update( program* a_program ) const
+void nv::keyframed_mesh::update( program* a_program )
 {
 	a_program->set_opt_uniform( "nv_interpolate", m_interpolation );
@@ -123,5 +123,5 @@
 }
 
-nv::keyframed_mesh_gpu::keyframed_mesh_gpu( device* a_device, const mesh_data* a_data, const mesh_nodes_data* a_tag_map, program* a_program )
+nv::keyframed_mesh_gpu::keyframed_mesh_gpu( device* a_device, const mesh_data* a_data, const mesh_nodes_data* a_tag_map )
 	: keyframed_mesh( a_device, a_data, a_tag_map )
 	, m_loc_next_position( -1 )
@@ -131,13 +131,5 @@
 	, m_gpu_next_frame( 0xFFFFFFFF )
 {
-	m_loc_next_position = a_program->get_attribute( "nv_next_position" )->get_location();
-	m_loc_next_normal   = a_program->get_attribute( "nv_next_normal" )->get_location();
-	m_loc_next_tangent  = a_program->try_get_attribute_location( "nv_next_tangent" );
 	m_va = a_device->create_vertex_array( a_data, STATIC_DRAW );
-	vertex_buffer* vb = m_va->find_buffer( slot::POSITION );
-	m_va->add_vertex_buffer( m_loc_next_position, vb, FLOAT, 3, 0, m_vsize, false );
-	m_va->add_vertex_buffer( m_loc_next_normal,   vb, FLOAT, 3, sizeof( vec3 ), m_vsize, false );
-	if ( m_has_tangent )
-		m_va->add_vertex_buffer( m_loc_next_tangent, vb, FLOAT, 4, 2*sizeof( vec3 ), m_vsize, false );
 }
 
@@ -145,4 +137,5 @@
 void nv::keyframed_mesh_gpu::update( uint32 ms )
 {
+	if ( m_loc_next_position == -1 ) return;
 	animated_mesh::update( ms );
 
@@ -157,5 +150,5 @@
 		m_gpu_last_frame = m_last_frame;
 	}
-	if ( m_gpu_next_frame != m_next_frame )
+	if ( m_loc_next_position != -1 && m_gpu_next_frame != m_next_frame )
 	{
 		m_va->update_vertex_buffer( m_loc_next_position, m_next_frame * m_vertex_count * m_vsize );
@@ -164,4 +157,22 @@
 		m_gpu_next_frame = m_next_frame;
 	}
+}
+
+void nv::keyframed_mesh_gpu::update( program* a_program )
+{
+	if ( m_loc_next_position == -1 )
+	{
+		m_loc_next_position = a_program->get_attribute( "nv_next_position" )->get_location();
+		m_loc_next_normal   = a_program->get_attribute( "nv_next_normal" )->get_location();
+		if ( m_has_tangent )
+			m_loc_next_tangent  = a_program->get_attribute( "nv_next_tangent" )->get_location();
+
+		vertex_buffer* vb = m_va->find_buffer( slot::POSITION );
+		m_va->add_vertex_buffer( m_loc_next_position, vb, FLOAT, 3, 0, m_vsize, false );
+		m_va->add_vertex_buffer( m_loc_next_normal,   vb, FLOAT, 3, sizeof( vec3 ), m_vsize, false );
+		if ( m_has_tangent )
+			m_va->add_vertex_buffer( m_loc_next_tangent, vb, FLOAT, 4, 2*sizeof( vec3 ), m_vsize, false );
+	}
+	keyframed_mesh::update( a_program );
 }
 
Index: trunk/src/gfx/skeletal_mesh.cc
===================================================================
--- trunk/src/gfx/skeletal_mesh.cc	(revision 295)
+++ trunk/src/gfx/skeletal_mesh.cc	(revision 296)
@@ -11,6 +11,6 @@
 
 
-nv::skeletal_mesh::skeletal_mesh( device* a_device, const mesh_data* a_mesh_data, const mesh_nodes_data* bones )
-	: animated_mesh()
+nv::skeletal_mesh_cpu::skeletal_mesh_cpu( device* a_device, const mesh_data* a_mesh_data, const mesh_nodes_data* bones )
+	: skeletal_mesh()
 	, m_data( a_mesh_data )
 {
@@ -29,9 +29,9 @@
 }
 
-void nv::skeletal_mesh::update_animation( animation_entry* a_anim, uint32 a_anim_time )
+void nv::skeletal_mesh_cpu::update_animation( animation_entry* a_anim, uint32 a_anim_time )
 {
 	if ( a_anim )
 	{
-		skeletal_animation_entry * anim = (skeletal_animation_entry*)a_anim;
+		skeletal_animation_entry_cpu * anim = (skeletal_animation_entry_cpu*)a_anim;
 		anim->update_skeleton( m_transform.data(), (float)a_anim_time );
 		{
@@ -70,5 +70,5 @@
 
 
-void nv::skeletal_animation_entry::update_skeleton( transform* skeleton, float time ) const
+void nv::skeletal_animation_entry_cpu::update_skeleton( transform* skeleton, float time ) const
 {
 	float frame_duration = 1000.f / (float)m_node_data->get_frame_rate();
@@ -85,15 +85,7 @@
 
 
-nv::skeletal_mesh::~skeletal_mesh()
+nv::skeletal_mesh_cpu::~skeletal_mesh_cpu()
 {
 	delete m_va;
-}
-
-void nv::skeletal_mesh::run_animation( animation_entry* a_anim )
-{
-	if ( a_anim != nullptr )
-	{
-		update_animation( a_anim, 0 );
-	}
 }
 
@@ -209,5 +201,5 @@
 
 nv::skeletal_mesh_gpu::skeletal_mesh_gpu( device* a_device, const mesh_data* a_mesh, const mesh_nodes_data* a_bone_data )
-	: animated_mesh(), m_bone_data( a_bone_data ), m_transform( nullptr )
+	: skeletal_mesh(), m_bone_data( a_bone_data ), m_transform( nullptr )
 {
 	m_va          = a_device->create_vertex_array( a_mesh, nv::STATIC_DRAW );
@@ -219,24 +211,15 @@
 }
 
-void nv::skeletal_mesh_gpu::run_animation( animation_entry* a_anim )
-{
-	if ( m_bone_data && a_anim != nullptr )
-	{
-		skeletal_animation_entry_gpu * anim = (skeletal_animation_entry_gpu*)(a_anim);
+void nv::skeletal_mesh_gpu::update_animation( animation_entry* a_anim, uint32 a_anim_time )
+{
+	if ( m_bone_data && a_anim )
+	{
+		skeletal_animation_entry_gpu * anim = (skeletal_animation_entry_gpu*)a_anim;
 		anim->prepare( m_bone_data );
-		update_animation( a_anim, 0 );
-	}
-}
-
-void nv::skeletal_mesh_gpu::update_animation( animation_entry* a_anim, uint32 a_anim_time )
-{
-	if ( m_bone_data && a_anim )
-	{
-		skeletal_animation_entry_gpu * anim = (skeletal_animation_entry_gpu*)a_anim;
 		anim->update_skeleton( m_transform, a_anim_time );
 	}
 }
 
-void nv::skeletal_mesh_gpu::update( program* a_program ) const
+void nv::skeletal_mesh_gpu::update( program* a_program )
 {
 	if ( m_bone_data )
