回答編集履歴
1
要因に関しての追記
answer
CHANGED
@@ -1,2 +1,19 @@
|
|
1
|
+
`glRotated`や`glTranslated`の影響範囲をインデントで表現すると,以下のような感じです.
|
2
|
+
|
3
|
+
```
|
4
|
+
glutSolidSphere(1.0, 20, 16); // sun
|
5
|
+
|
6
|
+
glRotated((double)year, 0.0, 1.0, 0.0);
|
7
|
+
glTranslated(3.0, 0.0, 0.0);
|
8
|
+
glRotated((double)day, 0.0, 1.0, 0.0);
|
9
|
+
glutSolidSphere(0.2, 10, 8);// planet
|
10
|
+
|
11
|
+
glTranslated(1.0, 0.0, 0.0);
|
12
|
+
glRotated((double)day, 0.0, 0.1, 0.0);
|
13
|
+
glutSolidSphere(0.2, 10, 8);// planet2
|
14
|
+
```
|
15
|
+
|
16
|
+
"planet2"用の`glutSolidSphere`は,上記全ての`glRotated`と`glTranslated`の影響を受ける形になっています.
|
17
|
+
|
1
18
|
回転や並進を**星毎に**設定すればよいのではないでしょうか.
|
2
19
|
`glPushMatrix`,`glPopMatrix`の意味を再確認すると良いでしょう.
|