it says crystalspace.maploader.parse.image: Could not open image file '' on VFS! at run time and the sphere still has no mesh! // load a texture file from disk // note filename is a VFS File name of texture void Body::Load_Texture(AppTest* app, std::string filename, std::string mat_name ) { csColor* transp; iTextureList* texturelist; csRef engine = app->GetEngine(); if (!engine) printf("Star::Load_Texture: Failed to locate iEngine renderer!\n"); csRef g3d = app->Get_g3d(); if (!g3d) printf("Body::Load_Image: Failed to locate 3D renderer!\n"); csRef loader = app->Get_Loader(); if (!loader) printf("Body::Load_Image: Failed to locate 3D renderer!\n"); csRef texture_manager = g3d->GetTextureManager(); if (!texture_manager) printf("Body::Load_Image: Failed to load Texture Manager!\n"); printf("before new File:%s\n", filename.c_str() ); csRef file = new csPhysicalFile( filename.c_str() ,"rb"); if (!file) printf("Body::Load_Image: Failed to open image file: %s!\n" , filename.c_str() ); csRef buf = file->GetAllData(); csRef texturewapper = loader->LoadTexture ( mat_name.c_str() , buf, CS_TEXTURE_3D, texture_manager , true, true, true ); iMaterialWrapper* mat = engine->GetMaterialList ()->FindByName (mat_name.c_str()); if ( !mat ) { printf(" Star::Load_Texture: Material %s not found!\n",mat_name.c_str() ); } // Now add the texture to the mesh if (!mesh->GetMeshObject ()->SetMaterialWrapper (mat)) printf ("Body::Load_Texture: Error SetMaterialWrapper failed\n") ; }