|
Generated by diff2html.pl © Yves Bailly, MandrakeSoft S.A. 2001, Ryohei Morita 2007 diff2html.pl is licensed under the GNU GPL. |
| ../07-02/07-02-EmbededObjects.c | 07-03-EmbededObjects.c | |||
|---|---|---|---|---|
|
98 lines 4035 bytes Last modified : Mon Nov 5 07:57:30 2012 |
101 lines 4083 bytes Last modified : Mon Nov 5 12:07:32 2012 |
|||
| 1 | // Keisanki Joron 2 (Introduction to Computing II) | 1 | // Keisanki Joron 2 (Introduction to Computing II) | |
| 2 | // Dept. of Engineering Systems, University of Tsukuba | 2 | // Dept. of Engineering Systems, University of Tsukuba | |
| 3 | // [UTF-8 / Unix] | 3 | // [UTF-8 / Unix] | |
| 4 | // 計算機序論2・実習 (筑波大学工学システム学類) | 4 | // 計算機序論2・実習 (筑波大学工学システム学類) | |
| 5 | 5 | |||
| 6 | // 2012/11/05a kameda[at]iit.tsukuba.ac.jp | 6 | // 2012/11/05a kameda[at]iit.tsukuba.ac.jp | |
| 7 | // 07.02. ファイル分割 | 7 | // 07.03. ファイル分割に伴う修正 | |
| 8 | ||||
| 9 | #include "ic2-CommonHeaders.h" | |||
| 10 | ||||
| 8 | 11 | |||
| 9 | // *********************************************************************** | 12 | // *********************************************************************** | |
| 10 | // EmbededObjects ******************************************************** | 13 | // EmbededObjects ******************************************************** | |
| 11 | 14 | |||
| 12 | // +++-------------------------------------------------- | 15 | // +++-------------------------------------------------- | |
| 13 | // ソース内部でのCG物体の直接描画 | 16 | // ソース内部でのCG物体の直接描画 | |
| 14 | // +++-------------------------------------------------- | 17 | // +++-------------------------------------------------- | |
| 15 | 18 | |||
| 16 | // +---------------------------------------------------- | 19 | // +---------------------------------------------------- | |
| 17 | // OpenGL Logoを描く | 20 | // OpenGL Logoを描く | |
| 18 | // +---------------------------------------------------- | 21 | // +---------------------------------------------------- | |
| 19 | // s はスケーリングファクタ(s=1.0 で 概ね -1.0 〜 1.0 の大きさ) | 22 | // s はスケーリングファクタ(s=1.0 で 概ね -1.0 〜 1.0 の大きさ) | |
| 20 | void ic2_OpenGLLogo (float s) { | 23 | void ic2_OpenGLLogo (float s) { | |
| 21 | // 光源によるシェーディング効果を切る(と色の指定が直接色になる) | 24 | // 光源によるシェーディング効果を切る(と色の指定が直接色になる) | |
| 22 | glDisable(GL_LIGHTING); | 25 | glDisable(GL_LIGHTING); | |
| 23 | 26 | |||
| 24 | // 線の幅(画素単位) | 27 | // 線の幅(画素単位) | |
| 25 | glLineWidth(1.0); | 28 | glLineWidth(1.0); | |
| 26 | 29 | |||
| 27 | // (R, G, B) 値域は 0.0 - 1.0 | 30 | // (R, G, B) 値域は 0.0 - 1.0 | |
| 28 | glColor3f(1.0, 1.0, 1.0); | 31 | glColor3f(1.0, 1.0, 1.0); | |
| 29 | 32 | |||
| 30 | // glBegin(GL_LINES); から glEnd(); までの間は、 | 33 | // glBegin(GL_LINES); から glEnd(); までの間は、 | |
| 31 | // 「始点・終点」ごとに線分が描画される | 34 | // 「始点・終点」ごとに線分が描画される | |
| 32 | glBegin(GL_LINES); | 35 | glBegin(GL_LINES); | |
| 33 | glVertex3f(s * -0.8, s * 0.8, 0.0); glVertex3f(s * -0.8, s * 0.2, 0.0); // O | 36 | glVertex3f(s * -0.8, s * 0.8, 0.0); glVertex3f(s * -0.8, s * 0.2, 0.0); // O | |
| 34 | glVertex3f(s * -0.8, s * 0.2, 0.0); glVertex3f(s * -0.4, s * 0.2, 0.0); // O | 37 | glVertex3f(s * -0.8, s * 0.2, 0.0); glVertex3f(s * -0.4, s * 0.2, 0.0); // O | |
| 35 | glVertex3f(s * -0.4, s * 0.2, 0.0); glVertex3f(s * -0.4, s * 0.8, 0.0); // O | 38 | glVertex3f(s * -0.4, s * 0.2, 0.0); glVertex3f(s * -0.4, s * 0.8, 0.0); // O | |
| 36 | glVertex3f(s * -0.4, s * 0.8, 0.0); glVertex3f(s * -0.8, s * 0.8, 0.0); // O | 39 | glVertex3f(s * -0.4, s * 0.8, 0.0); glVertex3f(s * -0.8, s * 0.8, 0.0); // O | |
| 37 | 40 | |||
| 38 | glVertex3f(s * -0.2, s * 0.6, 0.0); glVertex3f(s * -0.2, s * 0.0, 0.0); // p | 41 | glVertex3f(s * -0.2, s * 0.6, 0.0); glVertex3f(s * -0.2, s * 0.0, 0.0); // p | |
| 39 | glVertex3f(s * -0.2, s * 0.6, 0.0); glVertex3f(s * 0.0, s * 0.6, 0.0); // p | 42 | glVertex3f(s * -0.2, s * 0.6, 0.0); glVertex3f(s * 0.0, s * 0.6, 0.0); // p | |
| 40 | glVertex3f(s * 0.0, s * 0.6, 0.0); glVertex3f(s * 0.0, s * 0.2, 0.0); // p | 43 | glVertex3f(s * 0.0, s * 0.6, 0.0); glVertex3f(s * 0.0, s * 0.2, 0.0); // p | |
| 41 | glVertex3f(s * 0.0, s * 0.2, 0.0); glVertex3f(s * -0.2, s * 0.2, 0.0); // p | 44 | glVertex3f(s * 0.0, s * 0.2, 0.0); glVertex3f(s * -0.2, s * 0.2, 0.0); // p | |
| 42 | 45 | |||
| 43 | glVertex3f(s * 0.2, s * 0.4, 0.0); glVertex3f(s * 0.4, s * 0.4, 0.0); // e | 46 | glVertex3f(s * 0.2, s * 0.4, 0.0); glVertex3f(s * 0.4, s * 0.4, 0.0); // e | |
| 44 | glVertex3f(s * 0.4, s * 0.4, 0.0); glVertex3f(s * 0.4, s * 0.6, 0.0); // e | 47 | glVertex3f(s * 0.4, s * 0.4, 0.0); glVertex3f(s * 0.4, s * 0.6, 0.0); // e | |
| 45 | glVertex3f(s * 0.4, s * 0.6, 0.0); glVertex3f(s * 0.2, s * 0.6, 0.0); // e | 48 | glVertex3f(s * 0.4, s * 0.6, 0.0); glVertex3f(s * 0.2, s * 0.6, 0.0); // e | |
| 46 | glVertex3f(s * 0.2, s * 0.6, 0.0); glVertex3f(s * 0.2, s * 0.2, 0.0); // e | 49 | glVertex3f(s * 0.2, s * 0.6, 0.0); glVertex3f(s * 0.2, s * 0.2, 0.0); // e | |
| 47 | glVertex3f(s * 0.2, s * 0.2, 0.0); glVertex3f(s * 0.4, s * 0.2, 0.0); // e | 50 | glVertex3f(s * 0.2, s * 0.2, 0.0); glVertex3f(s * 0.4, s * 0.2, 0.0); // e | |
| 48 | 51 | |||
| 49 | glVertex3f(s * 0.6, s * 0.6, 0.0); glVertex3f(s * 0.6, s * 0.2, 0.0); // n | 52 | glVertex3f(s * 0.6, s * 0.6, 0.0); glVertex3f(s * 0.6, s * 0.2, 0.0); // n | |
| 50 | glVertex3f(s * 0.6, s * 0.6, 0.0); glVertex3f(s * 0.8, s * 0.6, 0.0); // n | 53 | glVertex3f(s * 0.6, s * 0.6, 0.0); glVertex3f(s * 0.8, s * 0.6, 0.0); // n | |
| 51 | glVertex3f(s * 0.8, s * 0.6, 0.0); glVertex3f(s * 0.8, s * 0.2, 0.0); // n | 54 | glVertex3f(s * 0.8, s * 0.6, 0.0); glVertex3f(s * 0.8, s * 0.2, 0.0); // n | |
| 52 | 55 | |||
| 53 | glVertex3f(s * 0.0, s * -0.2, 0.0); glVertex3f(s * -0.6, s * - 0.2, 0.0); // G | 56 | glVertex3f(s * 0.0, s * -0.2, 0.0); glVertex3f(s * -0.6, s * - 0.2, 0.0); // G | |
| 54 | glVertex3f(s * -0.6, s * -0.2, 0.0); glVertex3f(s * -0.6, s * - 0.8, 0.0); // G | 57 | glVertex3f(s * -0.6, s * -0.2, 0.0); glVertex3f(s * -0.6, s * - 0.8, 0.0); // G | |
| 55 | glVertex3f(s * -0.6, s * -0.8, 0.0); glVertex3f(s * 0.0, s * - 0.8, 0.0); // G | 58 | glVertex3f(s * -0.6, s * -0.8, 0.0); glVertex3f(s * 0.0, s * - 0.8, 0.0); // G | |
| 56 | glVertex3f(s * 0.0, s * -0.8, 0.0); glVertex3f(s * 0.0, s * - 0.5, 0.0); // G | 59 | glVertex3f(s * 0.0, s * -0.8, 0.0); glVertex3f(s * 0.0, s * - 0.5, 0.0); // G | |
| 57 | glVertex3f(s * 0.0, s * -0.5, 0.0); glVertex3f(s * -0.3, s * - 0.5, 0.0); // G | 60 | glVertex3f(s * 0.0, s * -0.5, 0.0); glVertex3f(s * -0.3, s * - 0.5, 0.0); // G | |
| 58 | 61 | |||
| 59 | glVertex3f(s * 0.2, s * -0.2, 0.0); glVertex3f(s * 0.2, s * - 0.8, 0.0); // L | 62 | glVertex3f(s * 0.2, s * -0.2, 0.0); glVertex3f(s * 0.2, s * - 0.8, 0.0); // L | |
| 60 | glVertex3f(s * 0.2, s * -0.8, 0.0); glVertex3f(s * 0.8, s * - 0.8, 0.0); // L | 63 | glVertex3f(s * 0.2, s * -0.8, 0.0); glVertex3f(s * 0.8, s * - 0.8, 0.0); // L | |
| 61 | glEnd(); | 64 | glEnd(); | |
| 62 | 65 | |||
| 63 | // glBegin(GL_LINE_LOOP); から glEnd(); までの間は、 | 66 | // glBegin(GL_LINE_LOOP); から glEnd(); までの間は、 | |
| 64 | // 全ての頂点を使った閉じた線分が描画される | 67 | // 全ての頂点を使った閉じた線分が描画される | |
| 65 | 68 | |||
| 66 | // 左上隅 | 69 | // 左上隅 | |
| 67 | glColor3f(1.0, 1.0, 1.0); | 70 | glColor3f(1.0, 1.0, 1.0); | |
| 68 | glBegin(GL_LINE_LOOP); | 71 | glBegin(GL_LINE_LOOP); | |
| 69 | glVertex3f(s * -1.0, s * 1.0, 0.0); | 72 | glVertex3f(s * -1.0, s * 1.0, 0.0); | |
| 70 | glVertex3f(s * -0.8, s * 1.0, 0.0); | 73 | glVertex3f(s * -0.8, s * 1.0, 0.0); | |
| 71 | glVertex3f(s * -1.0, s * 0.8, 0.0); | 74 | glVertex3f(s * -1.0, s * 0.8, 0.0); | |
| 72 | glEnd(); | 75 | glEnd(); | |
| 73 | 76 | |||
| 74 | // 右上隅 | 77 | // 右上隅 | |
| 75 | glColor3f(0.1, 1.0, 1.0); | 78 | glColor3f(0.1, 1.0, 1.0); | |
| 76 | glBegin(GL_LINE_LOOP); | 79 | glBegin(GL_LINE_LOOP); | |
| 77 | glVertex3f(s * 0.8, s * 1.0, 0.0); | 80 | glVertex3f(s * 0.8, s * 1.0, 0.0); | |
| 78 | glVertex3f(s * 1.0, s * 1.0, 0.0); | 81 | glVertex3f(s * 1.0, s * 1.0, 0.0); | |
| 79 | glVertex3f(s * 1.0, s * 0.8, 0.0); | 82 | glVertex3f(s * 1.0, s * 0.8, 0.0); | |
| 80 | glEnd(); | 83 | glEnd(); | |
| 81 | 84 | |||
| 82 | // 左下隅 | 85 | // 左下隅 | |
| 83 | glColor3f(1.0, 0.1, 1.0); | 86 | glColor3f(1.0, 0.1, 1.0); | |
| 84 | glBegin(GL_LINE_LOOP); | 87 | glBegin(GL_LINE_LOOP); | |
| 85 | glVertex3f(s * -1.0, s * -0.8, 0.0); | 88 | glVertex3f(s * -1.0, s * -0.8, 0.0); | |
| 86 | glVertex3f(s * -0.8, s * -1.0, 0.0); | 89 | glVertex3f(s * -0.8, s * -1.0, 0.0); | |
| 87 | glVertex3f(s * -1.0, s * -1.0, 0.0); | 90 | glVertex3f(s * -1.0, s * -1.0, 0.0); | |
| 88 | glEnd(); | 91 | glEnd(); | |
| 89 | 92 | |||
| 90 | // 右下隅 | 93 | // 右下隅 | |
| 91 | glColor3f(1.0, 1.0, 0.1); | 94 | glColor3f(1.0, 1.0, 0.1); | |
| 92 | glBegin(GL_LINE_LOOP); | 95 | glBegin(GL_LINE_LOOP); | |
| 93 | glVertex3f(s * 0.8, s * -1.0, 0.0); | 96 | glVertex3f(s * 0.8, s * -1.0, 0.0); | |
| 94 | glVertex3f(s * 1.0, s * -0.8, 0.0); | 97 | glVertex3f(s * 1.0, s * -0.8, 0.0); | |
| 95 | glVertex3f(s * 1.0, s * -1.0, 0.0); | 98 | glVertex3f(s * 1.0, s * -1.0, 0.0); | |
| 96 | glEnd(); | 99 | glEnd(); | |
| 97 | } | 100 | } | |
| 98 | 101 |