| 
 | Generated by UTF-8 version of diff2html.pl © Yves Bailly, MandrakeSoft S.A. 2001, Ryohei Morita 2007 diff2html.pl is licensed under the GNU GPL. | 
| ../08-03/08-03-Rendering.c | 08-04-Rendering.c | |||
|---|---|---|---|---|
| 44 lines 1313 bytes Last modified : Mon Nov 12 05:36:18 2012 | 45 lines 1460 bytes Last modified : Mon Nov 19 00:13:20 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/09a kameda[at]iit.tsukuba.ac.jp | 6 | // 2012/11/19b kameda[at]iit.tsukuba.ac.jp | |
| 7 | // 08.03. OpenGLでの行列操作の実際 | 7 | // 08.04. 多段階の行列操作 | |
| 8 | 8 | |||
| 9 | #include "ic2-CommonHeaders.h" | 9 | #include "ic2-CommonHeaders.h" | |
| 10 | 10 | |||
| 11 | 11 | |||
| 12 | // *********************************************************************** | 12 | // *********************************************************************** | |
| 13 | // Rendering ************************************************************* | 13 | // Rendering ************************************************************* | |
| 14 | 14 | |||
| 15 | // +++-------------------------------------------------- | 15 | // +++-------------------------------------------------- | |
| 16 | // スクリーンに描画する | 16 | // スクリーンに描画する | |
| 17 | // +++-------------------------------------------------- | 17 | // +++-------------------------------------------------- | |
| 18 | 18 | |||
| 19 | // +---------------------------------------------------- | 19 | // +---------------------------------------------------- | |
| 20 | // 1フレーム分の描画 | 20 | // 1フレーム分の描画 | |
| 21 | // +---------------------------------------------------- | 21 | // +---------------------------------------------------- | |
| 22 | void ic2_DrawFrame (void) { | 22 | void ic2_DrawFrame (void) { | |
| 23 | // (1) 描画バッファの初期化 | 23 | // (1) 描画バッファの初期化 | |
| 24 | // 以前にglClearColor()で指定した色で塗り潰す | 24 | // 以前にglClearColor()で指定した色で塗り潰す | |
| 25 | glClear(GL_COLOR_BUFFER_BIT); | 25 | glClear(GL_COLOR_BUFFER_BIT); | |
| 26 | 26 | |||
| 27 | // (2) カメラの設定 | 27 | // (2) カメラの設定 | |
| 28 | ic2_SetUpCamera_Ortho(); | 28 | ic2_SetUpCamera_Ortho(); | |
| 29 | 29 | |||
| 30 | // (3) 光源の設置 | 30 | // (3) 光源の設置 | |
| 31 | 31 | |||
| 32 | // (4) 物体の描画 | 32 | // (4) 物体の描画 | |
| 33 | ic2_ShowMATRIX ("Before"); | 33 | ic2_ShowMATRIX ("Before"); | |
| 34 | glMatrixMode(GL_MODELVIEW); | 34 | glMatrixMode(GL_MODELVIEW); | |
| 35 | glLoadIdentity(); | 35 | //-- 【TR】実装ここから | |
| 36 | ic2_ShowMATRIX ("After I is loaded"); | 36 | glLoadIdentity(); ic2_ShowMATRIX ("After I is loaded"); | |
| 37 | glTranslatef(0.01, 0, 0); | 37 | glTranslatef(0.7, 0, 0); ic2_ShowMATRIX ("After +0.7 along X axis"); | |
| 38 | ic2_ShowMATRIX ("After T is applied"); | 38 | glRotatef(45, 0, 0, 1); ic2_ShowMATRIX ("After +45 degree rotation around Z axis"); | |
| 39 | //-- 【TR】実装ここまで | |||
| 39 | ic2_OpenGLLogo(logoscale); | 40 | ic2_OpenGLLogo(logoscale); | |
| 40 | 41 | |||
| 41 | // (5) 描画バッファの切替 | 42 | // (5) 描画バッファの切替 | |
| 42 | glutSwapBuffers(); | 43 | glutSwapBuffers(); | |
| 43 | } | 44 | } | |
| 44 | 45 |