| 
 | Generated by diff2html.pl © Yves Bailly, MandrakeSoft S.A. 2001, Ryohei Morita 2007 diff2html.pl is licensed under the GNU GPL. | 
| ../11-03/11-03-MainFunction.c | 11-04-MainFunction.c | |||
|---|---|---|---|---|
| 53 lines 1594 bytes Last modified : Mon Nov 19 12:49:47 2012 | 53 lines 1583 bytes Last modified : Mon Nov 19 12:53:12 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/19a kameda[at]iit.tsukuba.ac.jp | 6 | // 2012/11/19a kameda[at]iit.tsukuba.ac.jp | |
| 7 | // 11.03. プログラム完全統合 | 7 | // 11.04. ポリゴン表示 | |
| 8 | 8 | |||
| 9 | #include "ic2-CommonHeaders.h" | 9 | #include "ic2-CommonHeaders.h" | |
| 10 | 10 | |||
| 11 | 11 | |||
| 12 | // *********************************************************************** | 12 | // *********************************************************************** | |
| 13 | // MainFunction ********************************************************** | 13 | // MainFunction ********************************************************** | |
| 14 | 14 | |||
| 15 | // +---------------------------------------------------- | 15 | // +---------------------------------------------------- | |
| 16 | // 大域変数 | 16 | // 大域変数 | |
| 17 | // +---------------------------------------------------- | 17 | // +---------------------------------------------------- | |
| 18 | 18 | |||
| 19 | float logoscale = 0.95; | 19 | float logoscale = 0.95; | |
| 20 | struct ic2PATCH *firstpatchptr = NULL; | |||
| 20 | 21 | |||
| 21 | // +---------------------------------------------------- | 22 | // +---------------------------------------------------- | |
| 22 | // Main Function | 23 | // Main Function | |
| 23 | // +---------------------------------------------------- | 24 | // +---------------------------------------------------- | |
| 24 | int main (int argc, char *argv[]) { | 25 | int main (int argc, char *argv[]) { | |
| 25 | char *modelfilenameptr = NULL; | 26 | char *modelfilenameptr = NULL; | |
| 26 | int numberofpatches = 0; | 27 | int numberofpatches = 0; | |
| 27 | struct ic2PATCH *firstpatchptr = NULL; | |||
| 28 | 28 | |||
| 29 | // model ファイルの読み込み | 29 | // model ファイルの読み込み | |
| 30 | if (argc <= 1) { | 30 | if (argc <= 1) { | |
| 31 | printf("Warning: no model file is specified, \"%s\" is assumed.\n", IC2DEFAULTMODEL); | 31 | printf("Warning: no model file is specified, \"%s\" is assumed.\n", IC2DEFAULTMODEL); | |
| 32 | modelfilenameptr = IC2DEFAULTMODEL; | 32 | modelfilenameptr = IC2DEFAULTMODEL; | |
| 33 | } else { | 33 | } else { | |
| 34 | modelfilenameptr = argv[1]; | 34 | modelfilenameptr = argv[1]; | |
| 35 | } | 35 | } | |
| 36 | numberofpatches = ic2_ReadModel(modelfilenameptr, &firstpatchptr); | 36 | numberofpatches = ic2_ReadModel(modelfilenameptr, &firstpatchptr); | |
| 37 | if (numberofpatches < 0) { | 37 | if (numberofpatches < 0) { | |
| 38 | printf("Error: invalid model \"%s\", reading failed.\n", modelfilenameptr); | 38 | printf("Error: invalid model \"%s\", reading failed.\n", modelfilenameptr); | |
| 39 | return 1; | 39 | return 1; | |
| 40 | } | 40 | } | |
| 41 | printf("Number of Patches in the model = %d \n", numberofpatches); | 41 | printf("Number of Patches in the model = %d \n", numberofpatches); | |
| 42 | 42 | |||
| 43 | // glutライブラリによる引数の解釈 | 43 | // glutライブラリによる引数の解釈 | |
| 44 | glutInit(&argc, argv); | 44 | glutInit(&argc, argv); | |
| 45 | 45 | |||
| 46 | // OpenGL Window の初期化 | 46 | // OpenGL Window の初期化 | |
| 47 | ic2_BootWindow(argv[0]); | 47 | ic2_BootWindow(argv[0]); | |
| 48 | 48 | |||
| 49 | // 無限ループの開始 | 49 | // 無限ループの開始 | |
| 50 | glutMainLoop(); | 50 | glutMainLoop(); | |
| 51 | 51 | |||
| 52 | return 0; | 52 | return 0; | |
| 53 | } | 53 | } |