A cube (the one with sides parallel to coordinate axes)
centered at the point $P=(x_0,y_0,z_0)$ of "radius" $r$
(and edge length $d=2r$)
has vertices $V_n=(x_0\pm r,y_0\pm r,z_0\pm r)$,
which could be enumerated for
$0\leq n=(b_2b_1b_0)_2=\sum_{i=0}^22^ib_i\leq 7$,
where $b_i=$(n>>i)&1
is the $i^\text{th}$ bit of $n$,
using the bitwise shift >>
and AND &
operators
(familiar in C-like languages & Java), as
$$
V_n=(x_0+(-1)^{b_0}r,y_0+(-1)^{b_1}r,z_0+(-1)^{b_2}r).
$$
The number of edges between two vertices $V_j,V_k$
would then be the bit weight of XOR$(j,k)=j$^$k$,
which is also known as the hamming distance.
You could emulate cube rotation by making the
opposite/inverse rotation in your perspective.
As column vectors, you could write
$$
P=\left[\begin{matrix}x_0\\y_0\\z_0\end{matrix}\right],\quad
R_n=r\left[\begin{matrix}\pm1\\\pm1\\\pm1\end{matrix}\right]
=r\left[\begin{matrix}(-1)^{b_0}\\(-1)^{b_1}\\(-1)^{b_2}\end{matrix}\right],\quad
V_n=P+R_n
$$
where $R_n$ are the radial vectors from the center $P$
to each vertex $V_n$. This would make it easier to rotate
your cube. You'd just need a rotation matrix $M$,
i.e. an orthogonal matrix
(which means that its transpose equals its inverse: $M^T=M^{-1}$)
with determinant $+1$ (also called special orthogonal),
and then $V_n=P+M\cdot R_n$ would give you the rotated vertices.
To rotate it about an arbitrary axis, you would need a special
orthogonal matrix $Q$ (for change of basis)
with a unit vector parallel to the
axis of rotation in say the $3^\text{rd}$ column
(and the other two columns containing perpendicular unit vectors
satisfying the right-hand rule), and a rotation matrix
such as this, which rotates the $xy$-plane about the $z$-axis:
$$
S=
\left[
\begin{matrix}
\cos\theta & -\sin\theta & 0 \\
\sin\theta & \cos\theta & 0 \\
0 & 0 & 1
\end{matrix}
\right].
$$
Then you could take $M=QSQ^T$ (cf. 3D graphics approach).
Another excellent method for generating rotations,
recommended by @J.M. and which you may prefer,
uses Rodrigues' rotation formula.
The modern computer graphics approach is usually a bit different
than the matrix math of 3D linear transformations,
because it uses perspective projection,
which uses a $4\times4$ matrix.
Since you mention OpenGL, for a cube
you might want to look some place like here or here.
From @Blue's answer to my Mathematics StackExchange question:
![enter image description here](https://i.stack.imgur.com/7diy4.png)
Construct $\bigcirc A$ through $O$.
- Let $P_1$ and $P_2$ be the points where $\bigcirc A$ meets $\bigcirc O$.
Construct $\bigcirc P_1$ through $P_2$.
- Let $C$ be the (other) point where $\bigcirc P_1$ meets $\bigcirc O$.
Construct $\overleftrightarrow{OP_1}$.
- Let $Q_1$ and $Q_2$ be the points where $\overleftrightarrow{OP_1}$ meets $\bigcirc P_1$.
Construct $\overleftrightarrow{CQ_1}$.
- Let $B$ be the point where $\overleftrightarrow{CQ_1}$ meets $\bigcirc O$.
- Note that we have constructed $\overleftrightarrow{BC}$.
Construct $\overleftrightarrow{CQ_2}$.
- Let $D$ be the point where $\overleftrightarrow{CQ_2}$ meets $\bigcirc O$.
- Note that we have constructed $\overleftrightarrow{CD}$.
Construct $\overleftrightarrow{AB}$.
- Construct $\overleftrightarrow{AD}$.
Square $\square ABCD$, with constructed edge-lines, is inscribed in $\bigcirc O$. (Proof that the quadrilateral is, in fact, a square, is left as an exercise to the reader.)
Edit. Having been asked to elaborate on the square ...
As of Step 2, we know $\triangle P_1 P_2 C$ is equilateral and that $\overline{OA}$ is on the perpendicualr bisector of side $\overline{P_1 P_2}$. Therefore, $\overline{AC}$ is a diameter of $\bigcirc O$, and we have that $\angle ABC$ and $\angle ADC$ (for point $D$ constructed later) are right angles by Thales' Theorem.
As of Step 4, as observed by Jan and Tristan in the comments, $\overline{Q_1 Q_2}$ is a diameter of $\bigcirc{P_1}$, so $\angle O_1 C Q_2$ is a right angle. Therefore, $\square ABCD$ is at least a rectangle.
Now, define $a := |\overline{OA}|$, so that $|\overline{P_1P_2}| = a\sqrt{3}$ and $|\overline{OQ_1}| = a( 1 + \sqrt{3})$. Since $\angle AOQ_1 = 60^\circ$, if we let $R$ be the foot of the perpendicular from $Q_1$ to $\overleftrightarrow{OA}$, then $|\overline{OR}| = \frac{a}{2}( 1 + \sqrt{3})$ and
$$|\overline{Q_1R}| = \frac{a \sqrt{3}}{2}(1+\sqrt{3}) = \frac{a}{2}(3 + \sqrt{3}) = a + |\overline{OR}| = |\overline{CR}|$$ Thus, $\angle Q_1 C R = 45^\circ$ and we may conclude that $\square ABCD$ is a square. $\square$
Best Answer
The answer to the question from screenshot is a truncated octahedron. If you consider center of the cube and a vertex, the locus of equidistant points is a perpendicular bisector plane. 8 of those planes create an octahedron. However, if you consider centers of other cubes, locus of equidistant points with them will give the initial cube itself. So the answer is the intersection of cube and octahedron, which is a truncated octahedron.