Generating natural texture Coords

How (can) texture coords be generated (glTexGen**()) so that textures apply in a logical manner (can a cube be textured with an image of bricks completely around without distortion)? Thanks