Problem in texturing a cube
Blender's viewport has limited support for generated and object coordinates.

GLSL preview materials only support a subset of Blender node material textures and features as stated in this bug report and this one too

You can fake it or workaround it using node materials, as shown in this video