By Mike Damert, Damert@navpoint.com.
The wall textures, thankfully, are already done in the sample program Simple2. Let's look at the code that actually loads the texture:
if (!loader->LoadTexture ("stone", "/lib/std/stone4.gif"))
{
  csReport (object_reg, CS_REPORTER_SEVERITY_ERROR,
    "crystalspace.application.simple2",
    "Error loading 'stone4' texture!");
  return false;
}
What this does is it loads a texture which the engine will call "stone", which can be found at the path "/lib/std/stone4.gif". The path to this folder is defined in the file vfs.cfg, which can be found in the CS base folder. The actual location of the file is in "CS/data/stdtex.zip", but the vfs.cfg changes the path to the file, which (I believe) allows us to use zip files.
If the file is not found, then we print an error message and return false, which, in Simple2, will tell the program to close.
iMaterialWrapper* tm = engine->GetMaterialList ()->FindByName ("stone");
Now let's look at the above line. It creates an iMaterialWrapper, which the API tells us is "an engine-level object that wraps around an actual mesh object". Basically, the iMaterialWrapper is our way of getting the texture. So how do we use that texture and put it on a polygon?
room = engine->CreateSector ("room");
iMeshWrapper* walls = engine->CreateSectorWallsMesh (room, "walls");
ThingState* walls_state = SCF_QUERY_INTERFACE (walls->GetMeshObject (),
  iThingState);
iPolygon3D* p;
p = walls_state->CreatePolygon ();
p->SetMaterial (tm);
p->CreateVertex (csVector3 (-5, 0, 5));
p->CreateVertex (csVector3 (5, 0, 5));
p->CreateVertex (csVector3 (5, 0, -5));
p->CreateVertex (csVector3 (-5, 0, -5));
p->SetTextureSpace (p->GetVertex (0), p->GetVertex (1), 3);
I won't go over many of the details of that code, because it doesn't belong under this topic, but the call
p->SetMaterial (tm);
Assigns the texture to that polygon, and then
p->SetTextureSpace (p->GetVertex (0), p->GetVertex (1), 3);
(which is a necessary call) tells the engine that the texture should appear with the first vertex as the origin and the second vertex as the u-axis. The third number is the scaling of the texture--the smaller the number, the smaller the texture will appear and vice versa.