The important bit of your code:
// Render a wall
glTexCoord2f(0, 0);
glNormal3f(wall.a.x > 0 ? 1 : -1, wall.a.y > 0 ? 1 : -1, wall.a.z > 0 ? 1 : -1);
glVertex3f(wall.a.x, wall.a.y, wall.a.z);
glTexCoord2f(xS, 0);
glNormal3f(wall.b.x > 0 ? 1 : -1, wall.b.y > 0 ? 1 : -1, wall.b.z > 0 ? 1 : -1);
glVertex3f(wall.b.x, wall.b.y, wall.b.z);
glTexCoord2f(xS, yS);
glNormal3f(wall.c.x > 0 ? 1 : -1, wall.c.y > 0 ? 1 : -1, wall.c.z > 0 ? 1 : -1);
glVertex3f(wall.c.x, wall.c.y, wall.c.z);
glTexCoord2f(0, yS);
glNormal3f(wall.d.x > 0 ? 1 : -1, wall.d.y > 0 ? 1 : -1, wall.d.z > 0 ? 1 : -1);
glVertex3f(wall.d.x, wall.d.y, wall.d.z);
If I read correctly, that gives the 8 corners of your cube normal vectors pointing outwards. All the vertices (of different faces) at the same corner have the same normal. Thus, your making a 'rounded' cube, there are no edges visible on a single cube.
I would give all the vertices making up one side of the cube the same normal. For example, for the x-most wall, use the normal (1,0,0)
for all its faces.
Solution: call glNormal3f
once for each side with the correct normal vector.