回答編集履歴

1

要因に関しての追記

2020/06/15 09:49

投稿

fana
fana

スコア11658

test CHANGED
@@ -1,3 +1,37 @@
1
+ `glRotated`や`glTranslated`の影響範囲をインデントで表現すると,以下のような感じです.
2
+
3
+
4
+
5
+ ```
6
+
7
+ glutSolidSphere(1.0, 20, 16); // sun
8
+
9
+
10
+
11
+ glRotated((double)year, 0.0, 1.0, 0.0);
12
+
13
+ glTranslated(3.0, 0.0, 0.0);
14
+
15
+ glRotated((double)day, 0.0, 1.0, 0.0);
16
+
17
+ glutSolidSphere(0.2, 10, 8);// planet
18
+
19
+
20
+
21
+ glTranslated(1.0, 0.0, 0.0);
22
+
23
+ glRotated((double)day, 0.0, 0.1, 0.0);
24
+
25
+ glutSolidSphere(0.2, 10, 8);// planet2
26
+
27
+ ```
28
+
29
+
30
+
31
+ "planet2"用の`glutSolidSphere`は,上記全ての`glRotated`と`glTranslated`の影響を受ける形になっています.
32
+
33
+
34
+
1
35
  回転や並進を**星毎に**設定すればよいのではないでしょうか.
2
36
 
3
37
  `glPushMatrix`,`glPopMatrix`の意味を再確認すると良いでしょう.