"Advanced Transformations (Multiple Translations and Rotations)" - читать интересную книгу автораStep3 :Creating complicated paths in simple waysBy now you should start thinking that transformations are not so difficult after all. At the moment our code looks like that:
At this point, we can simply add a glRotatecall just before the firstglPushMatrix, in order to rotate the whole system in 1, 2 or 3 dimensions:
Resulting in the following: Ops, what is this cube doing in the middle of our system? It is there to show how to add a new completely unrelated system of transformations in our scene. To do so we have to add some new code before the previously explained one. This bit is easy, we just save the matrix, rotate it in all three axes, draw the cube-sphere object and restore the matrix before drawing our system of icosahedrons and toruses:
Are you impressed? You should not be,… yet. This system of objects looks very impressive but still you can see that the objects follow a certain pattern. If we add another rotation just before drawing the current scene, then things become quite chaotic:
If now we 'forget' to clear the color buffer, but remember to clear the depth buffer we could have a commercially looking screen saver! PS: Thanks to Chris Mathers for the clearing the depth buffer idea. |
|
|