Create a cube from grids

How can I create a cube showing six distinct number grids, one on each face.

I want to use Grid and Graphics3D, but don't know how to connect them together.

For example, the following code makes a cube out of a grid (Grid was called once so all the cube sides have the same type of elements):

vtc = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
(*VertexTextureCoordinates*)
coords =
{{{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}},
{{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 0, 1}},
{{1, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1}},
{{1, 1, 0}, {0, 1, 0}, {0, 1, 1}, {1, 1, 1}},
{{0, 1, 0}, {0, 0, 0}, {0, 0, 1}, {0, 1, 1}},
{{0, 0, 1}, {1, 0, 1}, {1, 1, 1}, {0, 1, 1}}};

n = 9;(*Matrix Dimension*)
color = {Red, Blue, Green, Yellow, Orange, Black};
Table[
mat[k] =
Grid[Table[RandomInteger[{1, n^2}], {i, 1, n}, {j, 1, n}],
ItemStyle ->
Table[
{FontSize -> 20, Bold, RandomChoice[color]},
{i, 1, n}, {j, 1, n}],
Frame -> All],
{k, 1, 6}];

(*For 3D visual*)
Graphics3D[
Table[
{Texture[mat[k]], Polygon[coords[[k]], VertexTextureCoordinates -> vtc]},
{k, 1, 6}],
Boxed -> False]
(*use the same coords and vtc as before*)


I would greatly appreciate it if you could help me.

• This question needs clarification. There is no built-in Mathematica function Grids. You can't mean Grid because that is a formatting function, not a graphics function. Do you mean a lattice when you write grid? Also, it there are six different grids, what distinguishes them? Commented Jul 30, 2016 at 23:22
• mathematica.stackexchange.com/questions/38379/… Commented Jul 31, 2016 at 0:19
• @m_goldberg Thanks for your reply. I modified the question.. please check the new change Commented Jul 31, 2016 at 0:26
• @Young thanks but they are not using Grid Commented Jul 31, 2016 at 0:27
• I think I understand your question a little better now, but I still don't understand how want to vary the number grids from face to face. Do you want to use a different value of n on each face? If so, how will those values be determined? Commented Jul 31, 2016 at 11:43

Here is one idea for varying the grids.

vtc = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
coords =
{{{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}},
{{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 0, 1}},
{{1, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1}},
{{1, 1, 0}, {0, 1, 0}, {0, 1, 1}, {1, 1, 1}},
{{0, 1, 0}, {0, 0, 0}, {0, 0, 1}, {0, 1, 1}},
{{0, 0, 1}, {1, 0, 1}, {1, 1, 1}, {0, 1, 1}}};
color = {Red, Blue, Green, Brown, Orange, Black};

SeedRandom[42];
Table[
mat[k] =
Grid[
Table[
Item[RandomInteger[{1, k^2}],
BaseStyle -> {FontSize -> 200/k, Bold, RandomChoice[color]}],
{i, 1, k}, {j, 1, k}],
Frame -> All],
{k, 1, 6}];

Graphics3D[
Table[
{Texture[mat[k]], Polygon[coords[[k]], VertexTextureCoordinates -> vtc]},
{k, 1, 6}],
Boxed -> False]


Here are two views of the result.