The problem is most likely in one of the glFrustumf
or glOrthof
. The last parameter in this 2 calls will take z-far and it should be large enough for the primitive to be drawn. If a side length of the square is 1.0 and centre is in (.0, .0, .5) then z-far should be (> 1.0) to see the square rotated 90 degrees around X or Y axis. Though note these can depend on other matrix operations as well (translating the object or using tools like lookAt
).
Making this parameter large enough should solve your problem.
To achieve a perspective transformation use glFrustumf
instead of glOrthof
.