All pastes #224785 Raw Edit

Anonymous

public text v1 · immutable
#224785 ·published 2006-10-27 16:00 UTC
rendered paste body
getting the run time err from line "loader->LoadTexture "

"After GetAllData

crystalspace.maploader.parse.image:
  Could not open image file '<unknown>' on VFS!

crystalspace.maploader.parse.texture:
  Couldn't load image. Using checkerboard instead!
After create Texturewapper
Sector:system"



void Body::Load_Texture(AppTest* app, std::string filename, std::string mat_name ) { 
	csColor* transp;
	iTextureList* texturelist;

	csRef<iEngine> engine = app->GetEngine();
	if (!engine) printf("Star::Load_Texture: Failed to locate iEngine renderer!\n");

	csRef<iGraphics3D> g3d = app->Get_g3d();
	if (!g3d) printf("Body::Load_Image: Failed to locate 3D renderer!\n");

	csRef<iLoader> loader = app->Get_Loader();
	if (!g3d) printf("Body::Load_Image: Failed to locate 3D renderer!\n");

	csRef<iTextureManager> 	texture_manager = g3d->GetTextureManager();
	if (!texture_manager) printf("Body::Load_Image: Failed to load Texture Manager!\n");
	printf("before new File\n");
	csRef<csPhysicalFile> file = new csPhysicalFile( filename.c_str() ,"rb");
	if (!file) printf("Body::Load_Image: Failed to open image file: %s!\n" , filename.c_str() );
	
	csRef<iDataBuffer> buf = file->GetAllData();
	printf("After GetAllData\n");
	//mat_name.c_str()
	csRef<iTextureWrapper> texturewapper = loader->LoadTexture ( "gstar" ,
					buf, CS_TEXTURE_3D, 	texture_manager , true, true, true );

	printf("After create Texturewapper\n");


	iMaterialWrapper* mat = engine->GetMaterialList ()->FindByName (mat_name.c_str()); 

        //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") ;
		
}