#include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 Program 1 (OpenGL GameSample001) 5 // 6 static bool KeyUpON = false; // 7 sta

Size: px
Start display at page:

Download "#include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 Program 1 (OpenGL GameSample001) 5 // 6 static bool KeyUpON = false; // 7 sta"

Transcription

1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 Program 1 (OpenGL GameSample001) 5 // 6 static bool KeyUpON = false; // 7 static bool KeyDownON = false; // 8 static bool KeyLeftON = false; // 9 static bool KeyRightON = false; // static int MouseX = 0; // X 12 static int MouseY = 0; // Y 13 static float SpinX = 0; // X 14 static float SpinY = 0; // Y static float MoveX = 0; // X 17 static float MoveZ = 0; // Y 18 static float Scale = 1.0; // // 21 #define MAX_SHOT 10 // 22 typedef struct _MyShot{ 23 int isalive; // 24 float x; // x 25 float z; // z 26 float vx; // x 27 float vz; // z 28 } MyShot; 29 // 30 typedef struct _MyShip{ 31 int isalive; // 32 float x; // x 33 float z; // z 34 MyShot myshot[max_shot];// 35 } MyShip; 36 MyShip myship; // // 39 #define MAX_ENEMY 10 // 40 typedef struct _Enemy{ 41 int isalive; // 42 float x; // x 43 float z; // z 44 float vx; // x 45 float vz; // z 46 } Enemy; 47 Enemy enemy[max_enemy]; // // ( ) 50 void keyboard(unsigned char key, int x, int y) 51 { 52 switch (key) { 53 case : 54 //printf ("(%3d,%3d) \ n", x, y); 55 for (int i=0;i<max_shot; i++){ 56 if(myship.myshot[i].isalive == 0){ 57 myship.myshot[i].isalive = 1; 58 myship.myshot[i].x = myship.x; 59 myship.myshot[i].z = myship.z; 60 break; 61 } 62 } 63 break; 64 } 65 } // ( ) 68 void specialkey(int key, int x, int y) 69 { 70 switch (key) { 71 case GLUT_KEY_UP: 72 //printf ("(%3d,%3d) [ ] \ n", x, y); 73 KeyUpON = true; 74 break; 75 case GLUT_KEY_DOWN: 76 //printf ("(%3d,%3d) [ ] \ n", x, y); 77 KeyDownON = true; 78 break; 1

2 79 case GLUT_KEY_LEFT: 80 //printf ("(%3d,%3d) [ ] \ n", x, y); 81 KeyLeftON = true; 82 break; 83 case GLUT_KEY_RIGHT: 84 //printf ("(%3d,%3d) [ ] \ n", x, y); 85 KeyRightON = true; 86 break; 87 } 88 } void specialkeyup(int key, int x, int y) 91 { 92 switch (key) { 93 case GLUT_KEY_UP: 94 //printf ("(%3d,%3d) [ ] \ n", x, y); 95 KeyUpON = false; 96 break; 97 case GLUT_KEY_DOWN: 98 //printf ("(%3d,%3d) [ ] \ n", x, y); 99 KeyDownON = false; 100 break; 101 case GLUT_KEY_LEFT: 102 //printf ("(%3d,%3d) [ ] \ n", x, y); 103 KeyLeftON = false; 104 break; 105 case GLUT_KEY_RIGHT: 106 //printf ("(%3d,%3d) [ ] \ n", x, y); 107 KeyRightON = false; 108 break; 109 } 110 } void timer(int t) // T i m e r 113 { 114 // 115 if(keyupon == 1) myship.z -= 0.1; 116 if(keydownon == 1) myship.z += 0.1; 117 if(keylefton == 1) myship.x -= 0.1; 118 if(keyrighton== 1) myship.x += 0.1; // 121 for (int i=0;i<max_shot; i++){ 122 if(myship.myshot[i].isalive == 1){ 123 myship.myshot[i].z += myship.myshot[i].vx; // x 124 myship.myshot[i].z += myship.myshot[i].vz; // z 125 } 126 if(myship.myshot[i].z < -100) // ( ) 127 myship.myshot[i].isalive = 0; // ( ) 128 } // 131 int NofEnemys = 0; // 132 for(int i=0;i<max_enemy; i++){ 133 if(enemy[i].isalive == 1){ // i 134 // 135 enemy[i].x += enemy[i].vx +((float)rand()/rand_max - 0.5); // x ( ) 136 enemy[i].z += enemy[i].vz + ((float)rand()/rand_max); // z ( ) 137 NofEnemys++; // 138 } 139 if(enemy[i].z > 10 enemy[i].x < -10 enemy[i].x > 10) // ( ) 140 enemy[i].isalive = 0; // ( ) 141 } // 144 for(int i=0;i<max_enemy;i++){ 145 for(int j=0;j<max_shot;j++){ 146 // 147 if(((enemy[i].x - myship.myshot[j].x)*(enemy[i].x - myship.myshot[j].x)+ 148 (enemy[i].z - myship.myshot[j].z)*(enemy[i].z - myship.myshot[j].z)) < 2.0 ){ 149 enemy[i].isalive = 0; // 150 myship.myshot[j].isalive = 0; // ( ) 151 } 152 } 153 } // 156 // M A X _ E N E M Y if (NofEnemys <MAX_ENEMY){ 158 for(int i=0;i<max_enemy; i++){ 159 // i s A l i v e 0 i s A l i v e // 161 if(enemy[i].isalive == 0){ 162 enemy[i].x = ((float)rand()/ RAND_MAX - 0.5) * 10; 163 enemy[i].z = ((float)rand()/ RAND_MAX - 0.5) * 100; 164 enemy[i].isalive = 1; 165 break; 166 } 2

3 167 } 168 } // 171 for(int i=0;i<max_enemy; i++){ 172 // 173 if(((enemy[i].x - myship.x)*(enemy[i].x - myship.x) 174 +(enemy[i].z - myship.z)*(enemy[i].z - myship.z)) < 2.0 ){ 175 myship.isalive = 0; // 176 } 177 } glutpostredisplay (); // 180 gluttimerfunc(20, timer, 20); // 181 } void reshape(int w, int h) // R e s h a p e 184 { 185 glviewport(0, 0, w, h); glmatrixmode(gl_projection); 188 glloadidentity (); 189 gluperspective (50.0, (double)w/h, 1.0, ); glmatrixmode(gl_modelview); 192 glloadidentity (); 193 glulookat(0.0, 5.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); 194 } // 197 void DrawMyShip(void) 198 { 199 glpushmatrix (); 200 GLfloat mat0ambi[] = { , , , 1.0};// 201 glmaterialfv(gl_front_and_back, GL_AMBIENT, mat0ambi); // 202 GLfloat mat0diff[] = { , , , 1.0};// 203 glmaterialfv(gl_front_and_back, GL_DIFFUSE, mat0diff); // 204 GLfloat mat0spec[] = { , , , 1.0};// 205 glmaterialfv(gl_front_and_back, GL_SPECULAR, mat0spec); // 206 GLfloat mat0shine[] ={ };// 207 glmaterialfv(gl_front_and_back, GL_SHININESS, mat0shine); 208 // 209 gltranslatef(myship.x, 0.0, myship.z); // X M o v e X Y M o v e Y 210 glrotatef(90.0, 0.0, 1.0, 0.0); // Y glutsolidteapot (1.0); // ( ) 212 glpopmatrix(); // 215 for(int i=0;i<max_shot;i++){ 216 if(myship.myshot[i].isalive){ 217 glpushmatrix (); 218 gltranslatef(myship.myshot[i].x, 0.0, myship.myshot[i].z); // 219 glutsolidsphere (0.1,10,10); // 220 glpopmatrix(); 221 } 222 } 223 } // 226 void DrawEnemy(void) 227 { 228 GLfloat mat0ambi[] = { , , , 1.0};// 229 glmaterialfv(gl_front_and_back, GL_AMBIENT, mat0ambi); // 230 GLfloat mat0diff[] = { , , , 1.0};// 231 glmaterialfv(gl_front_and_back, GL_DIFFUSE, mat0diff); // 232 GLfloat mat0spec[] = { , , , 1.0};// 233 glmaterialfv(gl_front_and_back, GL_SPECULAR, mat0spec); // 234 GLfloat mat0shine[] ={ };// 235 glmaterialfv(gl_front_and_back, GL_SHININESS, mat0shine); // 238 for(int i=0;i<max_enemy;i++){ 239 if(enemy[i].isalive == 1){ 240 glpushmatrix (); 241 gltranslatef(enemy[i].x, 0.0, enemy[i].z); // 242 glutsolidcube (1.0); // 243 glpopmatrix(); 244 } 245 } 246 } void display(void) // D i s p l a y 249 { 250 glclearcolor(0.0, 0.0, 0.0, 1.0); // 251 glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); // 252 glenable(gl_depth_test); // // Game O v e r 3

4 255 if (myship.isalive ==0){ 256 // 257 glpushmatrix (); 258 GLfloat matstring[] = { 0.8, 0.0, 0.2, 1.0 }; // 259 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, matstring); 260 glrasterpos3f(-1.0f, 0.0f, 0.0f); 261 char *str = "Game Over"; 262 while(*str){ 263 glutbitmapcharacter(glut_bitmap_helvetica_18, *str); str; 265 } 266 glpopmatrix(); 267 }else{ 268 // 269 DrawMyShip(); // 270 DrawEnemy(); // 271 } // 274 glpushmatrix (); // X 275 GLfloat mat1diff[] = { 0.6, 0.2, 0.2, 1.0 }; // 276 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat1diff); 277 glnormal3f(0.0, 1.0, 0.0); // 278 glbegin(gl_lines); 279 glvertex3f (0.0f, 0.0f, 0.0f); 280 glvertex3f (2.0f, 0.0f, 0.0f); 281 glend(); 282 glpopmatrix(); 283 glpushmatrix (); // Y 284 GLfloat mat2diff[] = { 0.2, 0.6, 0.2, 1.0 }; // 285 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat2diff); 286 glnormal3f(0.0, 1.0, 0.0); // 287 glbegin(gl_lines); 288 glvertex3f (0.0f, 0.0f, 0.0f); 289 glvertex3f (0.0f, 2.0f, 0.0f); 290 glend(); 291 glpopmatrix(); 292 glpushmatrix (); // Z 293 GLfloat mat3diff[] = { 0.2, 0.2, 0.6, 1.0 }; // 294 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat3diff); 295 glnormal3f(0.0, 1.0, 0.0); // 296 glbegin(gl_lines); 297 glvertex3f (0.0f, 0.0f, 0.0f); 298 glvertex3f (0.0f, 0.0f, 2.0f); 299 glend(); 300 glpopmatrix(); glutswapbuffers (); // 303 } void lightinit(void) // ( ) 306 { 307 glenable(gl_lighting); // 308 glenable(gl_light0); //0 (8 ) 309 glenable(gl_normalize); // GLfloat light0pos[] = { 0.0, 10.0, 0.0, 1.0 }; 312 gllightfv(gl_light0, GL_POSITION, light0pos); // GLfloat light0ambi[] = { 0.2, 0.2, 0.2, 1.0 }; 315 gllightfv(gl_light0, GL_AMBIENT, light0ambi); // GLfloat light0diff[] = { 0.8, 0.8, 0.8, 1.0 }; 317 gllightfv(gl_light0, GL_DIFFUSE, light0diff); // GLfloat light0spec[] = { 0.5, 0.5, 0.5, 1.0 }; 319 gllightfv(gl_light0, GL_SPECULAR, light0spec); // glshademodel(gl_smooth); // 322 } int main(int argc, char *argv[]) 325 { 326 glutinit(&argc, argv); // G L U T 327 glutinitdisplaymode(glut_rgba GLUT_DOUBLE GLUT_DEPTH); 328 glutinitwindowsize(640, 480); // 329 glutcreatewindow("window"); // 330 glutreshapefunc(reshape); // R e s h a p e 331 glutdisplayfunc(display); // D i s p l a y glutkeyboardfunc(keyboard); // ( ) 334 glutspecialfunc(specialkey); // ( ) 335 glutspecialupfunc(specialkeyup);// ( ) gluttimerfunc(20, timer, 20); // // 340 myship.x = 0; // ( X ) 341 myship.z = 0; // ( Z ) 342 myship.isalive = 1; // 4

5 343 // ( Z -1.0 ) 344 for(int i=0; i<max_shot; i++){ 345 myship.myshot[i].isalive = 0; // 346 myship.myshot[i].x = 0; // ( X ) 347 myship.myshot[i].z = 0; // ( X ) 348 myship.myshot[i].vx = 0; // ( X ) 349 myship.myshot[i].vz = -1.0; // ( X ) } 352 // ( Z 0.1 ) 353 for(int i=0; i<max_enemy; i++){ 354 enemy[i].isalive = 0; // 355 enemy[i].x = 0; // ( X ) 356 enemy[i].z = -100; // ( Z ) 357 enemy[i].vx = 0; // ( X ) 358 enemy[i].vz = 0.1; // ( Z ) 359 } lightinit(); // ( ) 362 glutmainloop (); // return 0; 365 } 5

6 2. 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #define _USE_MATH_DEFINES 5 #include <math.h> 6 7 #include <GL/glut.h> 8 9 #define FALSE 0 10 #define TRUE typedef struct{ 13 unsigned char c; 14 int x,y; 15 }Key; 16 Key _key; 17 Program 2 (OpenGL GameSample002) 18 // 19 #define MAZE_WIDTH 10 // 20 #define MAZE_HEIGHT // 0: 1: 2: x y 22 // 1 23 static const int maze[maze_height][maze_width ]={ 24 {1,1,1,1,1,1,1,1,1,1}, 25 {1,2,1,0,1,0,1,0,0,1}, 26 {1,0,1,0,1,0,1,1,0,1}, 27 {1,0,1,0,1,0,0,0,0,1}, 28 {1,0,1,0,1,0,0,0,0,1}, 29 {1,0,1,0,1,0,0,0,0,1}, 30 {1,0,1,0,1,0,1,1,0,1}, 31 {1,0,1,0,1,0,1,0,0,1}, 32 {1,0,0,0,0,0,1,0,0,1}, 33 {1,1,1,1,1,1,1,1,1,1} 34 }; 35 static const double HEX_SIZE =1.0/ MAZE_WIDTH; // enum DIR{UP,RIGHT,BOTTOM,LEFT,DIR_NUM}; // 38 static const int DX[DIR_NUM]={0,-1,0,1}; // x y 39 static const int DY[DIR_NUM]={1,0,-1,0}; 40 static const double DT[DIR_NUM]={M_PI/2.0,M_PI,-M_PI/2,0.0}; // radian 41 enum MODE{MODE_STOP,MODE_GO,MODE_TURN}; // 42 typedef struct{ 43 unsigned char alive; // 44 unsigned int fcnt; // 45 int ix,iy; // 46 unsigned int d; // 47 double cx,cy; // 48 double dx,dy; // 49 double bx,by; // 50 double cct;// 51 double bct; // 52 double dct; // 53 unsigned int mode; // 54 unsigned int fdul; // 55 }MyBody; // 56 MyBody mb; // // 59 void draw_maze(void) 60 { 61 // ( ) 62 static const GLfloat white[] = { 0.9, 0.9, 0.9, 1.0 }; 63 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, white); for(int r=0;r<maze_height;++r){ 66 for(int c=0;c<maze_width;++c){ 67 glpushmatrix ();{ 68 // 69 gltranslatef((c+0.5)* HEX_SIZE,-HEX_SIZE,(r+0.5)* HEX_SIZE); 70 glutsolidcube(hex_size); 71 if(maze[r][c]==1){ 72 // 73 glpushmatrix ();{ 74 gltranslatef(0,hex_size,0); // 75 glutsolidcube(hex_size); 76 }glpopmatrix(); 77 } 78 }glpopmatrix(); 79 }} 80 } // 83 void draw_mb(void) 84 { 6

7 85 glpushmatrix ();{ 86 // ( ) 87 static const GLfloat red[] = { 0.8, 0.2, 0.2, 1.0 }; 88 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, red); 89 gltranslatef(mb.cx,0.0,mb.cy); 90 glutsolidsphere(hex_size *0.25,50,50); 91 }glpopmatrix(); 92 } void timerfunc(int t) // T i m e r 95 { 96 // 97 switch(_key.c){ 98 case s :{ //up 99 if(mb.mode==mode_stop){ // 100 int tx=mb.ix+dx[mb.d]; int ty=mb.iy+dy[mb.d]; // 101 if(maze[ty][tx]!=1){ // 102 // 103 mb.ix=tx; mb.iy=ty; 104 // 105 mb.bx=mb.cx; mb.by=mb.cy; // 106 mb.dx=(mb.ix+0.5)* HEX_SIZE; mb.dy=(mb.iy+0.5)* HEX_SIZE; // 107 mb.fcnt=0; 108 mb.mode=mode_go; 109 } 110 } 111 break; 112 }case c :{ //right 113 if(mb.mode==mode_stop){ // 114 // 115 // 116 mb.bct=dt[mb.d]; 117 mb.d=(mb.d+1)% DIR_NUM; 118 mb.dct=mb.bct+m_pi/2.0; // 119 mb.fcnt=0; 120 mb.mode=mode_turn; 121 } 122 break; 123 }case x :{ //bottom 124 if(mb.mode==mode_stop){ // 125 // 126 // 127 mb.bct=dt[mb.d]; 128 mb.d=(mb.d+2)% DIR_NUM; 129 mb.dct=mb.bct+m_pi; // 130 mb.fcnt=0; 131 mb.mode=mode_turn; 132 } 133 break; 134 }case z :{ //left 135 if(mb.mode==mode_stop){ // 136 // 137 // 138 mb.bct=dt[mb.d]; 139 mb.d=(mb.d-1+dir_num)%dir_num; 140 mb.dct=mb.bct -M_PI/2.0; // 141 mb.fcnt=0; 142 mb.mode=mode_turn; 143 } 144 break; 145 }default: 146 break; 147 } 148 _key.c=0; // // 151 if(mb.mode==mode_go){ // 152 // 153 mb.cx=(mb.dx-mb.bx)*mb.fcnt/mb.fdul+mb.bx; 154 mb.cy=(mb.dy-mb.by)*mb.fcnt/mb.fdul+mb.by; 155 mb.fcnt+=1; 156 if(mb.fcnt==mb.fdul){ // 157 mb.cx=(mb.ix+0.5)* HEX_SIZE; 158 mb.cy=(mb.iy+0.5)* HEX_SIZE; 159 mb.mode=mode_stop; 160 } 161 }else if(mb.mode==mode_turn){ // 162 // 163 mb.cct=(mb.dct -mb.bct)*mb.fcnt/mb.fdul+mb.bct; 164 mb.fcnt+=1; 165 if(mb.fcnt==mb.fdul){ // 166 mb.cct=dt[mb.d]; 167 mb.mode=mode_stop; 168 } 169 } // 172 glutpostredisplay (); 7

8 173 // 174 gluttimerfunc(30,timerfunc,0); 175 } void specialkey(int key,int x,int y) 178 { 179 // 180 _key.x=x; 181 _key.y=y; switch (key) { 184 case GLUT_KEY_UP: 185 //printf ("(%3d,%3d) [ ] \ n", x, y); 186 _key.c= s ; 187 break; 188 case GLUT_KEY_DOWN: 189 //printf ("(%3d,%3d) [ ] \ n", x, y); 190 _key.c= x ; 191 break; 192 case GLUT_KEY_LEFT: 193 //printf ("(%3d,%3d) [ ] \ n", x, y); 194 _key.c= z ; 195 break; 196 case GLUT_KEY_RIGHT: 197 //printf ("(%3d,%3d) [ ] \ n", x, y); 198 _key.c= c ; 199 break; 200 } 201 } void display(void) // D i s p l a y 204 { 205 glclearcolor(0.0, 0.0, 0.0, 1.0); // 206 glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); // 207 glenable(gl_depth_test); // glmatrixmode(gl_modelview); 210 glloadidentity (); // 213 glulookat(mb.cx,0.03,mb.cy, mb.cx+cos(mb.cct),0.03,mb.cy+sin(mb.cct), 0,1,0); // 216 // 217 GLfloat light_pos[] = { mb.cx, HEX_SIZE*0.5, mb.cy, 1.0 }; 218 gllightfv(gl_light0, GL_POSITION, light_pos); 219 GLfloat light_ambient[] = {0.1, 0.1, 0.1, 1.0}; 220 gllightfv(gl_light0, GL_AMBIENT, light_ambient); 221 GLfloat light_diffuse[] = {0.5, 0.5, 0.5, 1.0}; 222 gllightfv(gl_light0, GL_DIFFUSE, light_diffuse); 223 GLfloat light_specular[] = {0.1, 0.1, 0.1, 1.0}; 224 gllightfv(gl_light0, GL_SPECULAR, light_specular); 225 // 226 GLfloat spot_dir[] = {HEX_SIZE*cos(mb.cct),-HEX_SIZE*0.5, HEX_SIZE*sin(mb.cct)}; 227 gllightfv(gl_light0, GL_SPOT_DIRECTION, spot_dir); 228 gllightf(gl_light0, GL_SPOT_CUTOFF, 45.0); 229 gllightf(gl_light0, GL_SPOT_EXPONENT, 25.0); 230 // 231 gllightf(gl_light0, GL_CONSTANT_ATTENUATION, 0.5); 232 gllightf(gl_light0, GL_LINEAR_ATTENUATION, 0.2); 233 gllightf(gl_light0, GL_QUADRATIC_ATTENUATION, 0.2); 234 glenable(gl_light0); // 237 draw_maze(); // ( ) 240 draw_mb(); // 243 glutswapbuffers (); 244 } void lightinit(void) // ( ) 247 { 248 glenable(gl_lighting); // 249 glenable(gl_light0); //0 (8 ) 250 glenable(gl_normalize); // glshademodel(gl_smooth); // 253 } void reshape(int w, int h) // R e s h a p e 256 { 257 glviewport(0, 0, w, h); glmatrixmode(gl_projection); 260 glloadidentity (); 8

9 261 gluperspective (100.0, (double)w/h, 0.01, 10.0); // 262 } int main(int argc,char **argv) 265 { 266 glutinit(&argc, argv); // G L U T 267 glutinitdisplaymode(glut_double GLUT_RGBA GLUT_DEPTH); 268 glutinitwindowsize(640, 480); // 269 glutcreatewindow("window"); // 270 glutreshapefunc(reshape); // R e s h a p e 271 glutdisplayfunc(display); // D i s p l a y glutspecialfunc(specialkey); // ( ) 274 gluttimerfunc(30,timerfunc,0); // lightinit(); // ( ) // 279 // 280 for(int r=0;r<maze_height;++r){ 281 for(int c=0;c<maze_width;++c){ 282 if(maze[r][c]==2){ 283 mb.ix=c; 284 mb.iy=r; 285 goto loop_end; 286 } 287 }} 288 loop_end: // 291 mb.cx=(mb.ix+0.5)* HEX_SIZE; 292 mb.cy=(mb.iy+0.5)* HEX_SIZE; // 295 mb.alive=true; mb.fcnt=0; 296 mb.d=up; // 297 mb.cct=dt[mb.d]; // 298 mb.mode=mode_stop; // 299 mb.fdul=10; // glutmainloop (); // return 0; 304 } 9

10 3. 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <GL/glut.h> 4 Program 3 (OpenGL GameSample003) 5 // 6 static bool KeyUpON = false; // 7 static bool KeyDownON = false; // 8 static bool KeyLeftON = false; // 9 static bool KeyRightON = false; // static int MouseX = 0; // X 12 static int MouseY = 0; // Y 13 static float SpinX = 0; // X 14 static float SpinY = 0; // Y static float MoveX = 0; // X 17 static float MoveZ = 0; // Y 18 static float Scale = 1.0; // // 21 typedef struct _MyCharactor{ 22 int isalive; // 23 float x; // x 24 int movex_flg; // X 25 int movex_timer; // X 26 float z; // z 27 int movez_flg; // Z 28 int movez_timer; // Z int leftarm_shoulder; // 31 int leftarm_elbow; // 32 int leftarm_animationflg; // 33 int leftarm_timer; // int rightarm_shoulder; // 36 int rightarm_elbow; // 37 int rightarm_animationflg; // 38 int rightarm_timer; // 39 } MyCharactor; 40 // 41 MyCharactor mycharactor; 42 // 43 MyCharactor yourcharactor; // ( ) 46 void keyboard(unsigned char key, int x, int y) 47 { 48 switch (key) { 49 case g : 50 //printf ("(%3d,%3d) o \ n", x, y); 51 mycharactor.leftarm_animationflg = 1; 52 break; 53 case : 54 //printf ("(%3d,%3d) \ n", x, y); 55 mycharactor.rightarm_animationflg = 1; 56 break; 57 } 58 } // ( ) 61 void specialkey(int key, int x, int y) 62 { 63 switch (key) { 64 case GLUT_KEY_UP: 65 //printf ("(%3d,%3d) [ ] \ n", x, y); 66 KeyUpON = true; 67 break; 68 case GLUT_KEY_DOWN: 69 //printf ("(%3d,%3d) [ ] \ n", x, y); 70 KeyDownON = true; 71 break; 72 case GLUT_KEY_LEFT: 73 //printf ("(%3d,%3d) [ ] \ n", x, y); 74 KeyLeftON = true; 75 break; 76 case GLUT_KEY_RIGHT: 77 //printf ("(%3d,%3d) [ ] \ n", x, y); 78 KeyRightON = true; 79 break; 80 } 81 } void specialkeyup(int key, int x, int y) 84 { 10

11 85 switch (key) { 86 case GLUT_KEY_UP: 87 //printf ("(%3d,%3d) [ ] \ n", x, y); 88 KeyUpON = false; 89 break; 90 case GLUT_KEY_DOWN: 91 //printf ("(%3d,%3d) [ ] \ n", x, y); 92 KeyDownON = false; 93 break; 94 case GLUT_KEY_LEFT: 95 //printf ("(%3d,%3d) [ ] \ n", x, y); 96 KeyLeftON = false; 97 break; 98 case GLUT_KEY_RIGHT: 99 //printf ("(%3d,%3d) [ ] \ n", x, y); 100 KeyRightON = false; 101 break; 102 } 103 } static int MouseLB_ON=0; // 106 static int MouseRB_ON=0; // void mouse(int button, int state, int x, int y) 109 { 110 if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN){ 111 MouseLB_ON = 1; printf("(%3d,%3d) \ n", x, y); 112 }else if (button == GLUT_LEFT_BUTTON && state == GLUT_UP){ 113 MouseLB_ON = 0; printf("(%3d,%3d) \ n", x, y); 114 }else if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN){ 115 MouseRB_ON = 1; printf("(%3d,%3d) \ n", x, y); 116 }else if (button == GLUT_RIGHT_BUTTON && state == GLUT_UP){ 117 MouseRB_ON = 0; printf("(%3d,%3d) \ n", x, y); 118 } 119 } void dragmotion(int x, int y) 122 { 123 if (MouseLB_ON == 1){ 124 printf("(%3d,%3d)...\ n", x, y); 125 // 126 SpinX += x - MouseX; 127 SpinY += y - MouseY; 128 // 129 MouseX = x; 130 MouseY = y; 131 glutpostredisplay (); 132 } 133 else if (MouseRB_ON == 1){ 134 printf("(%3d,%3d)...\ n", x, y); 135 // 136 Scale += (float)(y - MouseY )/100; 137 // 138 MouseX = x; 139 MouseY = y; 140 glutpostredisplay (); 141 } 142 } void timer(int t) // T i m e r 145 { 146 // // 148 // // 150 if(keyupon == 1) mycharactor.z -= 0.1; 151 if(keydownon == 1) mycharactor.z += 0.1; 152 if(keylefton == 1) mycharactor.x -= 0.1; 153 if(keyrighton== 1) mycharactor.x += 0.1; // 156 if(mycharactor.rightarm_animationflg == 1 mycharactor.rightarm_timer > 0 ){ 157 mycharactor.rightarm_timer ++; 158 if(mycharactor.rightarm_timer <= 30){ 159 mycharactor.rightarm_elbow = mycharactor.rightarm_timer; 160 mycharactor.rightarm_shoulder = mycharactor.rightarm_timer *6; 161 } 162 if(mycharactor.rightarm_timer > 30 && mycharactor.rightarm_timer < 45 ){ 163 mycharactor.rightarm_elbow = 0 - (mycharactor.rightarm_timer -30)*2; 164 mycharactor.rightarm_shoulder = (mycharactor.rightarm_timer -30)*12; 165 } 166 if(mycharactor.rightarm_timer >= 45){ 167 mycharactor.rightarm_elbow = -30; 168 mycharactor.rightarm_shoulder = -30; 169 mycharactor.rightarm_animationflg = 0; 170 mycharactor.rightarm_timer = 0; 171 } 172 //printf("elbow:%5d,shoulder:%5d\n",mycharactor.rightarm_elbow,mycharactor.rightarm_shoulder); 11

12 173 } 174 // 175 if(mycharactor.leftarm_animationflg == 1 mycharactor.leftarm_timer > 0 ){ 176 mycharactor.leftarm_timer ++; 177 if(mycharactor.leftarm_timer <= 30){ 178 mycharactor.leftarm_elbow = 0 - mycharactor.leftarm_timer *2; 179 mycharactor.leftarm_shoulder = mycharactor.leftarm_timer *1; 180 } 181 else if(mycharactor.leftarm_timer > 30 && mycharactor.leftarm_timer < 45 ){ 182 mycharactor.leftarm_elbow = (mycharactor.leftarm_timer -30)*4; 183 mycharactor.leftarm_shoulder = (mycharactor.leftarm_timer -30)*2; 184 } 185 else if(mycharactor.leftarm_timer >= 45){ 186 mycharactor.leftarm_elbow = 0; 187 mycharactor.leftarm_shoulder = 180; 188 mycharactor.leftarm_animationflg = 0; 189 mycharactor.leftarm_timer = 0; 190 } 191 } 192 // // // 196 // // if(yourcharactor.movex_flg == 0){ // X ( ) 200 if( ((float)rand()/ RAND_MAX) > 0.5 ) yourcharactor.movex_flg = 1; 201 else yourcharactor.movex_flg = -1; 202 } 203 if(yourcharactor.movez_flg == 0){ // Z ( ) 204 if( ((float)rand()/ RAND_MAX) > 0.5 ) yourcharactor.movez_flg = 1; 205 else yourcharactor.movez_flg = -1; 206 } // if(yourcharactor.movex_flg > 0){ 210 yourcharactor.x += 0.1; 211 if(yourcharactor.movex_timer++ > 10){ 212 yourcharactor.movex_timer = 0; 213 yourcharactor.movex_flg = 0; 214 } 215 } 216 if(yourcharactor.movex_flg < 0){ 217 yourcharactor.x -= 0.1; 218 if(yourcharactor.movex_timer++ > 10){ 219 yourcharactor.movex_timer = 0; 220 yourcharactor.movex_flg = 0; 221 } 222 } 223 if(yourcharactor.movez_flg > 0){ 224 yourcharactor.z += 0.1; 225 if(yourcharactor.movez_timer++ > 10){ 226 yourcharactor.movez_timer = 0; 227 yourcharactor.movez_flg = 0; 228 } 229 } 230 if(yourcharactor.movez_flg < 0){ 231 yourcharactor.z -= 0.1; 232 if(yourcharactor.movez_timer++ > 10){ 233 yourcharactor.movez_timer = 0; 234 yourcharactor.movez_flg = 0; 235 } 236 } // 239 if( ((float)rand()/ RAND_MAX) > 0.99 ) yourcharactor.rightarm_animationflg = 1; // 242 if(yourcharactor.rightarm_animationflg == 1 yourcharactor.rightarm_timer > 0 ){ 243 yourcharactor.rightarm_timer ++; 244 if(yourcharactor.rightarm_timer <= 30){ 245 yourcharactor.rightarm_elbow = yourcharactor.rightarm_timer; 246 yourcharactor.rightarm_shoulder = yourcharactor.rightarm_timer *6; 247 } 248 if(yourcharactor.rightarm_timer > 30 && yourcharactor.rightarm_timer < 45 ){ 249 yourcharactor.rightarm_elbow = 0 - (yourcharactor.rightarm_timer -30)*2; 250 yourcharactor.rightarm_shoulder = (yourcharactor.rightarm_timer -30)*12; 251 } 252 if(yourcharactor.rightarm_timer >= 45){ 253 yourcharactor.rightarm_elbow = -30; 254 yourcharactor.rightarm_shoulder = -30; 255 yourcharactor.rightarm_animationflg = 0; 256 yourcharactor.rightarm_timer = 0; 257 } 258 //printf("elbow:%5d,shoulder:%5d\n",yourcharactor.rightarm_elbow,yourcharactor.rightarm_shoulder); 259 } 260 // 12

13 261 if(yourcharactor.leftarm_animationflg == 1 yourcharactor.leftarm_timer > 0 ){ 262 yourcharactor.leftarm_timer ++; 263 if(yourcharactor.leftarm_timer <= 30){ 264 yourcharactor.leftarm_elbow = 0 - yourcharactor.leftarm_timer *2; 265 yourcharactor.leftarm_shoulder = yourcharactor.leftarm_timer *1; 266 } 267 else if(yourcharactor.leftarm_timer > 30 && yourcharactor.leftarm_timer < 45 ){ 268 yourcharactor.leftarm_elbow = (yourcharactor.leftarm_timer -30)*4; 269 yourcharactor.leftarm_shoulder = (yourcharactor.leftarm_timer -30)*2; 270 } 271 else if(yourcharactor.leftarm_timer >= 45){ 272 yourcharactor.leftarm_elbow = 0; 273 yourcharactor.leftarm_shoulder = 180; 274 yourcharactor.leftarm_animationflg = 0; 275 yourcharactor.leftarm_timer = 0; 276 } 277 } 278 // // 281 double dist = (mycharactor.x-yourcharactor.x)*( mycharactor.x-yourcharactor.x) (mycharactor.z-yourcharactor.z)*( mycharactor.z-yourcharactor.z); 283 if(dist < 5.0){ 284 if(mycharactor.rightarm_timer > 30) yourcharactor.isalive = 0; 285 if(yourcharactor.rightarm_timer > 30) mycharactor.isalive = 0; 286 } glutpostredisplay (); // 289 gluttimerfunc(20, timer, 20); // 290 } void reshape(int w, int h) // R e s h a p e 293 { 294 glviewport(0, 0, w, h); glmatrixmode(gl_projection); 297 glloadidentity (); 298 gluperspective (50.0, (double)w/h, 1.0, ); glmatrixmode(gl_modelview); 301 glloadidentity (); 302 glulookat(0.0, 5.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); 303 } // 306 void DrawMyCharactor(void) 307 { 308 glpushmatrix (); 309 GLfloat mat0ambi[] = { , , , 1.0};// 310 glmaterialfv(gl_front_and_back, GL_AMBIENT, mat0ambi); // 311 GLfloat mat0diff[] = { , , , 1.0};// 312 glmaterialfv(gl_front_and_back, GL_DIFFUSE, mat0diff); // 313 GLfloat mat0spec[] = { , , , 1.0};// 314 glmaterialfv(gl_front_and_back, GL_SPECULAR, mat0spec); // 315 GLfloat mat0shine[] ={ };// 316 glmaterialfv(gl_front_and_back, GL_SHININESS, mat0shine); gltranslatef(mycharactor.x, 0.0, mycharactor.z); // X Z 319 glrotatef(-90, 0.0, 1.0, 0.0); // 322 glpushmatrix (); 323 gltranslatef(-0.6, 0.0, 0.0); 324 glrotatef(mycharactor.rightarm_shoulder/3, 0.0, 1.0, 0.0); // 327 glrotatef(mycharactor.rightarm_shoulder, 1.0, 0.0, 0.0); 328 gltranslatef(0.0, 0.5, 0.0); 329 glpushmatrix (); 330 glscalef (0.25,1.0,0.25); 331 glutsolidcube (1.0); 332 glpopmatrix(); gltranslatef(0.0, 0.5, 0.0); // 337 glrotatef(mycharactor.rightarm_elbow, 1.0, 0.0, 0.0); 338 gltranslatef(0.0, 0.5, 0.0); 339 glpushmatrix (); 340 glscalef (0.2,1.0,0.2); 341 glutsolidcube (1.0); 342 glpopmatrix(); 343 // 344 glpushmatrix (); 345 gltranslatef(0.0, 0.5, -0.75); 346 glscalef (0.05,0.05,1.5); 347 glutsolidcube (1.0); 348 glpopmatrix(); 13

14 glpopmatrix(); // 353 glpushmatrix (); 354 gltranslatef(0.6, 0.0, 0.0); 355 glrotatef(10, 0.0, 0.0, 1.0); // 358 glrotatef(mycharactor.leftarm_shoulder, 1.0, 0.0, 0.0); 359 gltranslatef(0.0, 0.5, 0.0); 360 glpushmatrix (); 361 glscalef (0.25,1.0,0.25); 362 glutsolidcube (1.0); 363 glpopmatrix(); gltranslatef(0.0, 0.5, 0.0); // 368 glrotatef(mycharactor.leftarm_elbow, 1.0, 0.0, 0.0); 369 gltranslatef(0.0, 0.5, 0.0); 370 glpushmatrix (); 371 glscalef (0.2,1.0,0.2); 372 glutsolidcube (1.0); 373 glpopmatrix(); glpopmatrix(); // 378 gltranslatef(0.0, 0.5, 0.0); 379 glutsolidsphere (0.5,12,12); // 382 gltranslatef(0.0, -1.0, 0.0); 383 glscalef (1.0,1.0,0.2); 384 glutsolidcube (1.0); glpopmatrix(); 387 } // 390 void DrawYourCharactor(void) 391 { 392 glpushmatrix (); 393 GLfloat mat0ambi[] = {0.1, , , 1.0};// 394 glmaterialfv(gl_front_and_back, GL_AMBIENT, mat0ambi); // 395 GLfloat mat0diff[] = {0.396, , , 1.0};// 396 glmaterialfv(gl_front_and_back, GL_DIFFUSE, mat0diff); // 397 GLfloat mat0spec[] = { , , , 1.0};// 398 glmaterialfv(gl_front_and_back, GL_SPECULAR, mat0spec); // 399 GLfloat mat0shine[] ={ 12.8 };// 400 glmaterialfv(gl_front_and_back, GL_SHININESS, mat0shine); gltranslatef(yourcharactor.x, 0.0, yourcharactor.z); // X Z 403 glrotatef(90, 0.0, 1.0, 0.0); // 406 glpushmatrix (); 407 gltranslatef(-0.6, 0.0, 0.0); 408 glrotatef(yourcharactor.rightarm_shoulder/3, 0.0, 1.0, 0.0); // 411 glrotatef(yourcharactor.rightarm_shoulder, 1.0, 0.0, 0.0); 412 gltranslatef(0.0, 0.5, 0.0); 413 glpushmatrix (); 414 glscalef (0.25,1.0,0.25); 415 glutsolidcube (1.0); 416 glpopmatrix(); gltranslatef(0.0, 0.5, 0.0); // 421 glrotatef(yourcharactor.rightarm_elbow, 1.0, 0.0, 0.0); 422 gltranslatef(0.0, 0.5, 0.0); 423 glpushmatrix (); 424 glscalef (0.2,1.0,0.2); 425 glutsolidcube (1.0); 426 glpopmatrix(); 427 // 428 glpushmatrix (); 429 gltranslatef(0.0, 0.5, -0.75); 430 glscalef (0.05,0.05,1.5); 431 glutsolidcube (1.0); 432 glpopmatrix(); glpopmatrix(); // 14

15 437 glpushmatrix (); 438 gltranslatef(0.6, 0.0, 0.0); 439 glrotatef(10, 0.0, 0.0, 1.0); // 442 glrotatef(yourcharactor.leftarm_shoulder, 1.0, 0.0, 0.0); 443 gltranslatef(0.0, 0.5, 0.0); 444 glpushmatrix (); 445 glscalef (0.25,1.0,0.25); 446 glutsolidcube (1.0); 447 glpopmatrix(); gltranslatef(0.0, 0.5, 0.0); // 452 glrotatef(yourcharactor.leftarm_elbow, 1.0, 0.0, 0.0); 453 gltranslatef(0.0, 0.5, 0.0); 454 glpushmatrix (); 455 glscalef (0.2,1.0,0.2); 456 glutsolidcube (1.0); 457 glpopmatrix(); glpopmatrix(); // 462 gltranslatef(0.0, 0.5, 0.0); 463 glutsolidsphere (0.5,12,12); // 466 gltranslatef(0.0, -1.0, 0.0); 467 glscalef (1.0,1.0,0.2); 468 glutsolidcube (1.0); glpopmatrix(); } void display(void) // D i s p l a y 475 { 476 glclearcolor(0.0, 0.0, 0.0, 1.0); // 477 glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); // 478 glenable(gl_depth_test); // // You Lose! 481 if (mycharactor.isalive ==0){ 482 // 483 glpushmatrix (); 484 GLfloat matstring[] = { 0.8, 0.0, 0.2, 1.0 }; // 485 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, matstring); 486 glrasterpos3f(-1.0f, 0.0f, 0.0f); 487 char *str = "You Lose!"; 488 while(*str){ 489 glutbitmapcharacter(glut_bitmap_helvetica_18, *str); str; 491 } 492 glpopmatrix(); 493 } 494 // You Win! 495 else if (yourcharactor.isalive ==0){ 496 // 497 glpushmatrix (); 498 GLfloat matstring[] = { 0.8, 0.0, 0.2, 1.0 }; // 499 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, matstring); 500 glrasterpos3f(-1.0f, 0.0f, 0.0f); 501 char *str = "You Win!"; 502 while(*str){ 503 glutbitmapcharacter(glut_bitmap_helvetica_18, *str); str; 505 } 506 glpopmatrix(); 507 } 508 // 509 else{ 510 glpushmatrix (); // 513 glrotatef(spinx, 1.0, 0.0, 0.0); // X S p i n X 514 glrotatef(spiny, 0.0, 1.0, 0.0); // Y S p i n Y 515 glscalef(scale, Scale, Scale); // S c a l e // 518 DrawMyCharactor (); // 519 DrawYourCharactor (); // // 522 glpushmatrix (); // X 523 GLfloat mat1diff[] = { 0.6, 0.2, 0.2, 1.0 }; // 524 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat1diff); 15

16 525 glnormal3f(0.0, 1.0, 0.0); // 526 glbegin(gl_lines); 527 glvertex3f (0.0f, 0.0f, 0.0f); 528 glvertex3f (2.0f, 0.0f, 0.0f); 529 glend(); 530 glpopmatrix(); 531 glpushmatrix (); // Y 532 GLfloat mat2diff[] = { 0.2, 0.6, 0.2, 1.0 }; // 533 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat2diff); 534 glnormal3f(0.0, 1.0, 0.0); // 535 glbegin(gl_lines); 536 glvertex3f (0.0f, 0.0f, 0.0f); 537 glvertex3f (0.0f, 2.0f, 0.0f); 538 glend(); 539 glpopmatrix(); 540 glpushmatrix (); // Z 541 GLfloat mat3diff[] = { 0.2, 0.2, 0.6, 1.0 }; // 542 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat3diff); 543 glnormal3f(0.0, 1.0, 0.0); // 544 glbegin(gl_lines); 545 glvertex3f (0.0f, 0.0f, 0.0f); 546 glvertex3f (0.0f, 0.0f, 2.0f); 547 glend(); 548 glpopmatrix(); glpopmatrix(); 551 } glutswapbuffers (); // 554 } void lightinit(void) // ( ) 557 { 558 glenable(gl_lighting); // 559 glenable(gl_light0); //0 (8 ) 560 glenable(gl_normalize); // GLfloat light0pos[] = { 0.0, 10.0, 0.0, 1.0 }; 563 gllightfv(gl_light0, GL_POSITION, light0pos); // GLfloat light0ambi[] = { 0.2, 0.2, 0.2, 1.0 }; 566 gllightfv(gl_light0, GL_AMBIENT, light0ambi); // GLfloat light0diff[] = { 0.8, 0.8, 0.8, 1.0 }; 568 gllightfv(gl_light0, GL_DIFFUSE, light0diff); // GLfloat light0spec[] = { 0.5, 0.5, 0.5, 1.0 }; 570 gllightfv(gl_light0, GL_SPECULAR, light0spec); // glshademodel(gl_smooth); // 573 } int main(int argc, char *argv[]) 576 { 577 glutinit(&argc, argv); // G L U T 578 glutinitdisplaymode(glut_rgba GLUT_DOUBLE GLUT_DEPTH); 579 glutinitwindowsize(640, 480); // 580 glutcreatewindow("window"); // 581 glutreshapefunc(reshape); // R e s h a p e 582 glutdisplayfunc(display); // D i s p l a y glutmousefunc(mouse); // 585 glutmotionfunc(dragmotion); // glutkeyboardfunc(keyboard); // ( ) 588 glutspecialfunc(specialkey); // ( ) 589 glutspecialupfunc(specialkeyup);// ( ) gluttimerfunc(20, timer, 20); // // 594 mycharactor.isalive = 1; // 595 mycharactor.x = 2; // ( X ) 596 mycharactor.movex_flg = 0; // X 597 mycharactor.movex_timer = 0; // X 598 mycharactor.z = 0; // ( Z ) 599 mycharactor.movez_flg = 0; // Z 600 mycharactor.movez_timer = 0; // Z mycharactor.rightarm_shoulder = -30; // 603 mycharactor.rightarm_elbow = -30; // 604 mycharactor.rightarm_timer = 0; // 605 mycharactor.rightarm_animationflg = 0; // 606 mycharactor.leftarm_shoulder = 180; // 607 mycharactor.leftarm_elbow = 0; // 608 mycharactor.leftarm_timer = 0; // 609 mycharactor.leftarm_animationflg = 0; // // 612 yourcharactor.isalive = 1; // 16

17 613 yourcharactor.x = -2; // ( X ) 614 yourcharactor.movex_flg = 0; // X 615 yourcharactor.movex_timer = 0; // X 616 yourcharactor.z = 0; // ( Z ) 617 yourcharactor.movez_flg = 0; // Z 618 yourcharactor.movez_timer = 0; // Z yourcharactor.rightarm_shoulder = -30; // 621 yourcharactor.rightarm_elbow = -30; // 622 yourcharactor.rightarm_timer = 0; // 623 yourcharactor.rightarm_animationflg = 0; // 624 yourcharactor.leftarm_shoulder = 180; // 625 yourcharactor.leftarm_elbow = 0; // 626 yourcharactor.leftarm_timer = 0; // 627 yourcharactor.leftarm_animationflg = 0; // lightinit(); // ( ) glutmainloop (); // return 0; 634 } 17

1 1. Program 1 OpenCV (OpenCV Sample001) 1 /* 2 - > - > - >VC++ 3 ( ) 4 C:\opencv\build\include 5 ( ) 6 C:\opencv\build\x86\vc10\lib 7 - > - > - > - >

1 1. Program 1 OpenCV (OpenCV Sample001) 1 /* 2 - > - > - >VC++ 3 ( ) 4 C:\opencv\build\include 5 ( ) 6 C:\opencv\build\x86\vc10\lib 7 - > - > - > - > 1 1. Program 1 OpenCV (OpenCV Sample001) 1 /* 2 - > - > - >VC++ 3 ( ) 4 C:\opencv\build\include 5 ( ) 6 C:\opencv\build\x86\vc10\lib 7 - > - > - > - > 8 (240 O p e n C V ) 9 opencv_core240d.lib 10 opencv_imgproc240d.lib

More information

Microsoft PowerPoint - info_eng3_05ppt.pptx

Microsoft PowerPoint - info_eng3_05ppt.pptx インタラクティブシステム構築法 第 5 回 OpenGL と GLUT の使い方 (3) 埼玉大学情報システム工学科小林貴訓 シェーディング 光源の設定を有効にする glenable(gl_lighting); // 光源の設定を有効にする glenable(gl_light0); //0 番目の光源を有効にする (8 個まで設定可能 ) 光源の位置 GLfloat light0pos[] = {

More information

/*p7-1-1*/

/*p7-1-1*/ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 /* e8.c Copyright (c) 2003 by T. HAYASHI and

More information

イントロダクション

イントロダクション プログラミング演習 IV 第 7 回マウス, キーボード, サウンド, 文字 埼玉大学情報システム工学科 小林貴訓 マウス入力 クリックイベントのコールバック関数の登録 glutmousefunc(mouse); クリックイベントのコールバック関数 // マウスクリックコールバック関数の指定 static int MouseLB_ON=0; // 左マウスボタン押下フラグ static int MouseRB_ON=0;

More information

3D グラフィックス処理の一般過程 1. 3D グラフィックス処理の一般過程

3D グラフィックス処理の一般過程 1. 3D グラフィックス処理の一般過程 3. 3D ビューイング 1. 3Dグラフィックス処理の一般過程 2. 射影と射影変換 3. ビューボリュームとクリッピング 4. 陰面処理とデプスバッファ 5. ビューポート変換 6. 3Dグラフィックスを描く 7. モデルビュー変換 3D グラフィックス処理の一般過程 1. 3D グラフィックス処理の一般過程 3D グラフィックス処理の一般過程 1. モデリング変換 座標系の異なる複数のオブジェクトを仮想世界に配置し,

More information

OpenGL & GLUTの基本関数の説明

OpenGL & GLUTの基本関数の説明 コンピュータグラフィックス S 演習資料 OpenGL & GLUT の基本関数の説明 1. OpenGL & GLUT 2. GLUT 2.1. GLUT void glutinit( int argc, char ** argv ); glut void glutinitdysplaymode( unsigned int mode ); mode void glutinitwindowsize(

More information

j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E

j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E 8 9 7 6 4 2 3 5 1 j x j j j + 1 l j l j = x j+1 x j, n x n x 1 = n 1 l j j=1 H j j + 1 l j l j E a n 1 H = ae l j, j=1 l j = x j+1 x j, x n x 1 = n 1 j=1 l j, l j = ±l l > 0) n 1 H = ϵ l j, j=1 ϵ e x x

More information

第3章 OpenGL の基礎

第3章 OpenGL の基礎 3 OpenGL April 11, 2017 1 / 28 3.1 ( ) OpenGL OpenGL 2 / 28 3.2 OpenGL OpenGL OpenGL (Open Graphics Library) Silicon Graphics, Inc. 2 3 API (Application Program Interface) [4] UNIX OS Windows Macintosh

More information

libaux.dvi

libaux.dvi AUX OpenGL 1 OpenGL (AUX libaux.a) OpenGL Programming Guide () OpenGL 1 OpenGL OS (API) OS OS OS OpenGL Windows Windows X X OpenGL Programming Guide AUX toolkit AUX OS OpenGL SGI OpenGL OS OpenGL AUX Windows

More information

Microsoft PowerPoint - 04.pptx

Microsoft PowerPoint - 04.pptx 初期化 コールバック関数の登録 glutmainloop() 描画関数 マウス処理関数 キーボード処理関数などの関数ポインタを登録する イベント待ちの無限ループ 再描画? no マウス入力? no キーボード入力? no yes yes yes 描画関数の呼び出し マウス処理関数の呼び出し キーボード処理関数の呼び出し void keyboard(unsigned char key, int x,

More information

2 2 GLUI 2 GLUI 2.1 GLUI GLUI OpenGL OpenGL glut OpenGL glut C++ Linux, Windows (Visual C++, gcc), Macintosh glut glut GUI glut GUI CG glmultmatrix()

2 2 GLUI 2 GLUI 2.1 GLUI GLUI OpenGL OpenGL glut OpenGL glut C++ Linux, Windows (Visual C++, gcc), Macintosh glut glut GUI glut GUI CG glmultmatrix() 1 20 (2) OpenGL+GUI(GLUI) 3DCG TA 2008 10 27 1 OpenGL OpenGL GUI GLUI 1.1 http://www.cyber.t.u-tokyo.ac.jp/~kuni/enshu2008/ 1.2 TA 1.3 2008/12/4( ) EyeToy 2 2 GLUI 2 GLUI 2.1 GLUI GLUI OpenGL OpenGL glut

More information

double rx[natom], ry[natom], rz[natom]; 原子の座標 速度 力 ポテンシャルエ double vx[natom], vy[natom], vz[natom]; ネルギーを受ける配列を準備 double fx[natom], fy[natom], fz[natom

double rx[natom], ry[natom], rz[natom]; 原子の座標 速度 力 ポテンシャルエ double vx[natom], vy[natom], vz[natom]; ネルギーを受ける配列を準備 double fx[natom], fy[natom], fz[natom GLUI による MD の GUI 化 前提条件 :GLUI のプログラミング環境が整っていること 3 原子の MD コード ( 下図 ) viewer ウィンドウ内のマウス左クリックで MD 開始 右クリックで MD 停止 control パネルは solid/wireframe を切り替えるチェックボタン 球の滑らかさと半径を決める窓 ( スピナー ) オブジェクトを回転 移動 拡大縮小させるコントローラ

More information

$ ls -l $ ls -l -a $ ls -la $ ls -F $ ls <dirname> <dirname> $ cd <dirname> <dirname> $ cd $ pwd $ cat <filename> <filename> $ less <filename> <filena

$ ls -l $ ls -l -a $ ls -la $ ls -F $ ls <dirname> <dirname> $ cd <dirname> <dirname> $ cd $ pwd $ cat <filename> <filename> $ less <filename> <filena $ pwd /home1/t0/t0903 / / /home1/t0/t0903 / / /home1/t0/t0903 / /... ~ $ ls $ ls -a $ ls -l $ ls -l -a $ ls -la $ ls -F $ ls $ cd $ cd $ pwd $ cat

More information

/* drawing function */ function_graph();// drawing graph glflush(); int main(int argc, char **argv ) glutinit( &argc, argv ); glutinitdisplaymode( GLU

/* drawing function */ function_graph();// drawing graph glflush(); int main(int argc, char **argv ) glutinit( &argc, argv ); glutinitdisplaymode( GLU OpenGL ( ) #include #include #define PI 3.14159265 void function_graph() int j; float x, y; glbegin( GL_LINE_STRIP );// sine curve by line glcolor3f( 0.0f, 1.0f, 1.0f );// line color

More information

2 : 2008/12/ /01/ G :

2 : 2008/12/ /01/ G : 2 : 2008/12/08 2008/01/16 075730G : 1 project draw main.cpp 1 draw main.cpp /* * main.cpp * draw * * Created by C-T on 08/12/08. * Copyright 2008 MyCompanyName. All rights reserved. * */ #include

More information

2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width height pixels void glreadpixels(glint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum t

2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width height pixels void glreadpixels(glint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum t 1 22 (2) OpenGL+GUI(GLUI) 3DCG TA 2010 10 18 1 OpenGL OpenGL GUI GLUI 1.1 http://www.cyber.t.u-tokyo.ac.jp/~kuni/enshu2010/ 1.2 TA 1.3 2010/12/6( ) USB 2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width height

More information

謗域・ュ逕ィppt

謗域・ュ逕ィppt 情報工学 2017 年度後期第 5 回 [11 月 1 日 ] 静岡大学 工学研究科機械工学専攻ロボット 計測情報講座創造科学技術大学院情報科学専攻 三浦憲二郎 講義日程 第 6 回 11 月 8 日画像処理パート第 1 回 第 7 回 11 月 15 日 CGパート第 6 回 第 8 回 11 月 22 日 CGパート第 7 回 第 9 回 11 月 29 日 CGパート試験 講義アウトライン [11

More information

2 2 OpenGL ( ) OpenGL ( ) glclearcolor(glclampf red, GLclampf green, GLclampf

2 2 OpenGL ( ) OpenGL ( ) glclearcolor(glclampf red, GLclampf green, GLclampf 1 24 (1) OpenGL TA 2012 10 11 1 C OpenGL (3DCG) OS Linux OS 3DCG OpenGL GUI GLUT OpenGL GLUT GLUI 3DCG 3DCG 1.1 1 3DCG 3DCG GUI 2 3DCG 10/10( ) 11/11( ) 3DCG OpenGL OpenGL+GUI(GLUI) 3DCG 3DCG 1.2 TA 2

More information

( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h>

( ) 1 1: 1 #include <s t d i o. h> 2 #include <GL/ g l u t. h> 3 #include <math. h> 4 #include <s t d l i b. h> 5 #include <time. h> 2007 12 5 1 2 2.1 ( ) 1 1: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 #define H WIN 400 // 8 #define W WIN 300 // 9

More information

第3章 OpenGL の基礎

第3章 OpenGL の基礎 3 OpenGL April 20, 2012 1 / 23 31 ( ) OpenGL OpenGL 2 / 23 32 OpenGL OpenGL OpenGL (Open Graphics Library) Silicon Graphics, Inc 2 3 API (Application Program Interface) [4] UNIX OS Windows Macintosh CAD

More information

1 OpenGL OpenGL OpenGL OpenGL

1 OpenGL OpenGL OpenGL OpenGL 2008 OpenGL 2009 2 27 1 OpenGL 4 1.1 OpenGL.............................. 4 1.2 OpenGL............... 4 1.2.1............... 4 1.2.2............................. 5 2 OpenGL 6 2.1.......................

More information

演算増幅器

演算増幅器 コンピュータグラフィックス 2 前回は GLUT を使った簡単な 2 次元グラフィックスについて習った 今週は以下の項目について 補足していく イベント駆動型プログラムの動作について コンピュータグラフィックスの座標系 イベント駆動型プログラム従来のプログラムとの違いこれまでに学習してきたプログラムは上から下に順次実行され 条件分岐や繰り返し処理によって プログラムの流れ (flow: フロー )

More information

第7章 レンダリング

第7章 レンダリング 7 April 11, 2017 1 / 59 7.1 ( ) CG 3 ( ) 2 / 59 7.2 7.2.1 ( ) 3 (rendering) 1 / (hidden line/surface calculation) a (outer normal algorithm) b Z (Z-buffer algorithm) c (scan-line algorithm) 2 (shading)

More information

第7章 レンダリング

第7章 レンダリング 7 May 18, 2012 1 / 60 71 ( ) CG 3 ( ) 2 / 60 72 71 ( ) 3 (rendering) 1 / (hidden line/surface calculation) a (outer normal algorithm) b Z (Z-buffer algorithm) c (scan-line algorithm) 2 (shading) a (flat

More information

準備 計算結果を可視化するために OpenGL を 利用する. 2

準備 計算結果を可視化するために OpenGL を 利用する. 2 2. 2 次元粒子法シミュレーション (+ 少しだけ OpenGL) 茨城大学工学部 教授乾正知 準備 計算結果を可視化するために OpenGL を 利用する. 2 OpenGL 3 次元コンピュータグラフィックス用の標準的なライブラリ. 特に CAD やアート, アニメーション分野 ( ゲーム以外の分野 ) で広く利用されている. OpenGL は仕様がオープンに決められており, 企業から独立した団体が仕様を管理している.

More information

演算増幅器

演算増幅器 スペースインベーダーもどき 1000 行プログラムの参考として スペースインベーダーもどきのプログラムを配布する いくつか習って いないものもあるので 補足の説明を加えていく 文字列の描画 文字の描画は glutbitmapcharacter() を用いる これは以下のようにして利用する int i; char *str = "Display String"; glcolor3f(0.0, 0.0,

More information

2 T ax 2 + 2bxy + cy 2 + dx + ey + f = 0 a + b + c > 0 a, b, c A xy ( ) ( ) ( ) ( ) u = u 0 + a cos θ, v = v 0 + b sin θ 0 θ 2π u = u 0 ± a

2 T ax 2 + 2bxy + cy 2 + dx + ey + f = 0 a + b + c > 0 a, b, c A xy ( ) ( ) ( ) ( ) u = u 0 + a cos θ, v = v 0 + b sin θ 0 θ 2π u = u 0 ± a 2 T140073 1 2 ax 2 + 2bxy + cy 2 + dx + ey + f = 0 a + b + c > 0 a, b, c A xy u = u 0 + a cos θ, v = v 0 + b sin θ 0 θ 2π u = u 0 ± a cos θ, v = v 0 + b tan θ π 2 < θ < π 2 u = u 0 + 2pt, v = v 0 + pt

More information

C B

C B C 095707B 2010 6 8 1 LEVE1 2 1.1 LEVEL 1.1................................................ 2 1.1.1 1................................................ 2 1.1.2 1.2..............................................

More information

2 3 OpenGL 2 OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI) 3D OpenGL SGI HP, SUN, IBM UNIX Linux, FreeBSD PC UNIX Windows, Mac OS API PD

2 3 OpenGL 2 OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI) 3D OpenGL SGI HP, SUN, IBM UNIX Linux, FreeBSD PC UNIX Windows, Mac OS API PD 1 2015 5-1 2015 6 22 1 3DCG 3DCG 3DCG OpenGL OS Linux(Ubuntu) 1.1 TA 1.2 http://www.cyber.t.u-tokyo.ac.jp/~tani/class/mech_enshu/ 2 3 OpenGL 2 OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI)

More information

$ pwd /home1/t0/t0903 / / /home1/t0/t0903 / / /home1/t0/t0903 / /... ~ $ ls $ ls -a

$ pwd /home1/t0/t0903 / / /home1/t0/t0903 / / /home1/t0/t0903 / /... ~ $ ls $ ls -a $ pwd /home1/t0/t0903 / / /home1/t0/t0903 / / /home1/t0/t0903 / /... ~ $ ls $ ls -a $ ls -l $ ls -l -a $ ls -la $ ls -F $ ls $ cd $ cd $ pwd $ cat

More information

2 2 OpenGL OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI) 3D OpenGL SGI HP, SUN,

2 2 OpenGL OpenGL OpenGL(Open Graphics Library) Silicon Graphics (SGI) 3D OpenGL SGI HP, SUN, 1 20 (1) OpenGL TA 2008 10 20 1 C OpenGL (3DCG) OS Linux (Open SUSE 10.3) 3DCG OpenGL GUI GLUT OpenGL GLUT GLUI USB EyeToy 1.1 1 3DCG 2 3DCG GUI 2 USB EyeToy) 10/20( ) 10/27( ) 3DCG OpenGL OpenGL+GUI(GLUI)

More information

manual.dvi

manual.dvi ' & VR CompleXcope $ % 1 2 509{5292 322{6 1) kage@tokitheorynifsacjp 2) sato@tokitheorynifsacjp CompleXcope Programming Guide, Ver 1, by A Kageyama and T Sato, August 1998 1 CompleXcope 5 11 : : : : :

More information

‚æ4›ñ

‚æ4›ñ ( ) ( ) ( ) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 (OUS) 9 26 1 / 28 ( ) ( ) ( ) A B C D Z a b c d z 0 1 2 9 (OUS) 9

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó  ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡ (2018) 2018 5 17 0 0 if switch if if ( ) if ( 0) if ( ) if ( 0) if ( ) (0) if ( 0) if ( ) (0) ( ) ; if else if ( ) 1 else 2 if else ( 0) 1 if ( ) 1 else 2 if else ( 0) 1 if ( ) 1 else 2 (0) 2 if else

More information

B05-139 2013 3 4 1 4 1.1........................................ 4 1.2................................... 4 1.3....................................... 4 1.4.................... 5 1.5.......................................

More information

3. OpenGL を利用するための準備作業 1) Tao Framework をダウンロードしてインストールする. Download から taoframework setup.exe をダウン

3. OpenGL を利用するための準備作業 1) Tao Framework をダウンロードしてインストールする.   Download から taoframework setup.exe をダウン [OpenGL:1] OpenGL とは 1.OpenGL とは何か? 米国 Silicon Graphics 社 (SGI) が中心となって開発した 3 次元グラフィックスライブラリである.SGI はグラフィックスに特化したワークステーション (GWS) の開発を積極的に行い, 自社の GWS 上で稼動するグラフィックスライブラリ IRIS GL を開発したが, その後, この仕様を公開したライブラリとして

More information

1) OOP 2) ( ) 3.2) printf Number3-2.cpp #include <stdio.h> class Number Number(); // ~Number(); // void setnumber(float n); float getnumber();

1) OOP 2) ( ) 3.2) printf Number3-2.cpp #include <stdio.h> class Number Number(); // ~Number(); // void setnumber(float n); float getnumber(); : : :0757230G :2008/07/18 2008/08/17 1) OOP 2) ( ) 3.2) printf Number3-2.cpp #include class Number Number(); // ~Number(); // void setnumber(float n); float getnumber(); private: float num; ;

More information

Microsoft Word - opengl講義資料ha.doc

Microsoft Word - opengl講義資料ha.doc [OpenGL:1] OpenGL とは 1.OpenGL とは何か? 米国 Silicon Graphics 社 (SGI) が中心となって開発した 3 次元グラフィックスライブラリである.SGI はグラフィックスに特化したワークステーション (GWS) の開発を積極的に行い, 自社の GWS 上で稼動するグラフィックスライブラリ IRIS GL を開発したが, その後, この仕様を公開したライブラリとして

More information

Fair Curve and Surface Design System Using Tangent Control

Fair Curve and Surface Design System Using Tangent Control 情報工学 2016 年度後期第 6 回 [11 月 16 日 ] 静岡大学工学研究科機械工学専攻ロボット 計測情報講座創造科学技術大学院情報科学専攻 三浦憲二郎 講義アウトライン [11 月 16 日 ] ビジュアル情報処理 3 モデリング 3.3 曲線 曲面 OpenGL 色の取り扱い シェーディング 照明モデルと照光処理 拡散光 鏡面光 環境光 ビジュアル情報処理 3-3 曲線 曲面 3-3-1

More information

Microsoft Word - opengl講義資料2013.doc

Microsoft Word - opengl講義資料2013.doc [OpenGL:1] OpenGL とは 1.OpenGL とは何か? 米国 Silicon Graphics 社 (SGI) が中心となって開発した 3 次元グラフィックスライブラリである.SGI はグラフィックスに特化したワークステーション (GWS) の開発を積極的に行い, 自社の GWS 上で稼動するグラフィックスライブラリ IRIS GL を開発したが, その後, この仕様を公開したライブラリとして

More information

2 2 OpenGL ( ) 2 OpenGL ( ) glclearcolor(glclampf red, GLclampf green, GLclampf blu

2 2 OpenGL ( )  2 OpenGL ( ) glclearcolor(glclampf red, GLclampf green, GLclampf blu 1 27 (1) OpenGL TA 2015 9 29 1 C OpenGL (3DCG) OS Linux OS 3DCG OpenGL 3DCG 3DCG 1.1 1 3DCG 3DCG 2 3DCG GUI AR 9/29( ) 10/1( ) 3DCG OpenGL 3DCG 3DCG 1.2 TA 1.3 2 2 OpenGL ( ) http://www.cyber.t.u-tokyo.ac.jp/~tani/class/mech_enshu/

More information

Tekutama AR ~ 拡張現実感によるオーバーレイ表示と動作 ~ 情報物理研究室 渡部 修平 1

Tekutama AR ~ 拡張現実感によるオーバーレイ表示と動作 ~ 情報物理研究室 渡部 修平 1 Tekutama AR ~ 拡張現実感によるオーバーレイ表示と動作 ~ 情報物理研究室 渡部 修平 1 目次 項 1. はじめに 3 2. 開発環境 4 2-1. ARToolkit 4 2-2. OpenGL GLUT 5 2-3. Metasequoia 6 2-4. GLMetaseq 6 3. 3DCG モデルの作成 7 4. AR プログラムの構成 9 4-1. main 関数 10 4-2.

More information

untitled

untitled 2004/12/21 2/2 (11/16) DT-MRI (11/30) /OpenGL 12/7 12/14 (12/21) 1/11 (1/18) OpenGL ~ ~ OpenGL Silicon Graphics, OpenGL ~ ~ OpenGL OpenGL Utility Library (GLU) OpenGL. OpenGL. OpenGL Utility Toolkit (GLUT)

More information

Microsoft Word - mediaJikkenCG_no2_2007.doc

Microsoft Word - mediaJikkenCG_no2_2007.doc 2007 年度メディア情報学実験 1 CG テキスト第 2~4 週 :OpenGL ライブラリを使った 3 次元 CG プログラミング立命館大学情報理工学部メディア情報学科 1. 実験の目的と手順本実験は,(1)OpenGLライブラリを用いたCGプログラミングの手法を学ぶ,(2) プログラミングを通して, CGの基礎技術を体験的に学ぶ,(3) インタラクティブな3 次元 CGアニメーションを作成する方法について学ぶ,

More information

ohp03.dvi

ohp03.dvi 19 3 ( ) 2019.4.20 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void int main(int argc, char *argv[]) {... 2 (2) argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0

More information

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

More information

2 2 2 OpenGL Linux Linux Video for Linux(Video4Linux, v4l ) API Video4Linux USB IEEE1394 API Linux Video for Linux 2(Video4Linux2, v4l2 ) OpenCV API U

2 2 2 OpenGL Linux Linux Video for Linux(Video4Linux, v4l ) API Video4Linux USB IEEE1394 API Linux Video for Linux 2(Video4Linux2, v4l2 ) OpenCV API U 1 26 (2) 3DCG TA 2014 10 17 1 OpenGL USB (3DCG) OpenCV CG Augmented Reality ARToolKit 3DCG 1.1 http://www.cyber.t.u-tokyo.ac.jp/~tani/class/mech_enshu/ 1.2 TA 1.3 ( ) USB (2014/11/10( ),11( ),13( )) (2012/11/17(

More information

OpenGL Programming Course OpenGL Programming Course FAQ

OpenGL Programming Course OpenGL Programming Course FAQ OpenGL NK EXA Corporation OpenGL@dst.nk-exa.co.jp OpenGL@dst.nk-exa.co.jp OpenGL FAQ (http://www.nk-exa.co.jp/mmtech/opengledu/faq.shtml) i 1 OpenGL 1{1 1.1 OpenGL : : : : : : : : : : : : : : : : : : :

More information

Condition DAQ condition condition 2 3 XML key value

Condition DAQ condition condition 2 3 XML key value Condition DAQ condition 2009 6 10 2009 7 2 2009 7 3 2010 8 3 1 2 2 condition 2 3 XML key value 3 4 4 4.1............................. 5 4.2...................... 5 5 6 6 Makefile 7 7 9 7.1 Condition.h.............................

More information

2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width height pixels void glreadpixels(glint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum t

2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width height pixels void glreadpixels(glint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum t 1 24 (2) 3DCG TA 2012 10 12 1 OpenGL USB (3DCG) OpenCV 1.1 http://www.cyber.t.u-tokyo.ac.jp/~tani/class/mech_enshu/ 1.2 TA 1.3 USB (2012/11/19( ),20( )) USB 2 2 2 OpenGL (R,G,B,A) 2.1 OpenGL (x y) width

More information

新版明解C言語 実践編

新版明解C言語 実践編 2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,

More information

1 level Level swtich ButtonPress ButtonRelease Expose Level

1 level Level swtich ButtonPress ButtonRelease Expose Level UNIX 4 2D/3D Grahpics,GUI :2-3 - 045708G 045726E 045730C 045735D 045759B 045762B 1 level1 1 11 2 12 4 13 6 14 6 2 Level2 6 21 6 211 swtich 11 212 ButtonPress 11 213 ButtonRelease 12 214 Expose 12 22 12

More information

r11.dvi

r11.dvi 19 11 ( ) 2019.4.20 1 / 1.1 ( n n O(n 2 O(n 2 ) ( 1 d n 1 n logn O(nlogn n ( n logn C 1.2 ( ( merge 2 1 1 3 1 4 5 4 2 3 7 9 7 1 2 3 4 5 7 9 1: 2 ivec merge int *ivec_new(int size) { int *a = (int*)malloc((size+1)

More information

ohp11.dvi

ohp11.dvi 19 11 ( ) 2019.4.20 1 / ( ) n O(n 2 ) O(n 2 ) ( ) 1 d n 1 n logn O(nlogn) n ( n logn C ) 2 ( ) ( merge) 2 1 1 3 1 4 5 4 2 3 7 9 7 1 2 3 4 5 7 9 1: 2 ivec merge 3 ( ) (2) int *ivec_new(int size) { int *a

More information

Microsoft Word - mediaJikkenCG_no2_2012.doc

Microsoft Word - mediaJikkenCG_no2_2012.doc 2012 年度メディア情報学実験 1 CG テキスト第 2~5 週 :OpenGL ライブラリを使った 3 次元 CG プログラミング立命館大学情報理工学部メディア情報学科 1. 実験の目的と手順本実験は,(1)OpenGLライブラリを用いたCGプログラミングの手法を学ぶ,(2) プログラミングを通して, CGの基礎技術を体験的に学ぶ,(3) インタラクティブな3 次元 CGアニメーションを作成する方法について学ぶ,

More information

untitled

untitled II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}

More information

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2018 2018 08 02 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF N N y N x N xy yx : yxxyxy N N x, y N (parse tree) (1) yxyyx (2) xyxyxy (3) yxxyxyy (4) yxxxyxxy N y N x N yx

More information

tuat1.dvi

tuat1.dvi ( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )

More information

r03.dvi

r03.dvi 19 ( ) 019.4.0 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void... argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0 a a \0 b b b \0 c c c \0 1: // argdemo1.c ---

More information

5. p.1/37

5. p.1/37 5. taiji@aihara.co.jp p.1/37 dx dt dy dt dz dt = σx + σy = xz + rx y = xy bz σ = 10, b = 8/3, r = 28, x 0 = 10, y 0 = 20, z 0 = 30 t < 10000δt (δt = 0.01) p.2/37 , 1991. Numerical Recipes in C Netlib LAPACK,

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) double

More information

Microsoft Word - C.....u.K...doc

Microsoft Word - C.....u.K...doc C uwêííôöðöõ Ð C ÔÖÐÖÕ ÐÊÉÌÊ C ÔÖÐÖÕÊ C ÔÖÐÖÕÊ Ç Ê Æ ~ if eíè ~ for ÒÑÒ ÌÆÊÉÉÊ ~ switch ÉeÍÈ ~ while ÒÑÒ ÊÍÍÔÖÐÖÕÊ ~ 1 C ÔÖÐÖÕ ÐÊÉÌÊ uê~ ÏÒÏÑ Ð ÓÏÖ CUI Ô ÑÊ ÏÒÏÑ ÔÖÐÖÕÎ d ÈÍÉÇÊ ÆÒ Ö ÒÐÑÒ ÊÔÎÏÖÎ d ÉÇÍÊ

More information

r08.dvi

r08.dvi 19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev

More information

x h = (b a)/n [x i, x i+1 ] = [a+i h, a+ (i + 1) h] A(x i ) A(x i ) = h 2 {f(x i) + f(x i+1 ) = h {f(a + i h) + f(a + (i + 1) h), (2) 2 a b n A(x i )

x h = (b a)/n [x i, x i+1 ] = [a+i h, a+ (i + 1) h] A(x i ) A(x i ) = h 2 {f(x i) + f(x i+1 ) = h {f(a + i h) + f(a + (i + 1) h), (2) 2 a b n A(x i ) 1 f(x) a b f(x)dx = n A(x i ) (1) ix [a, b] n i A(x i ) x i 1 f(x) [a, b] n h = (b a)/n y h = (b-a)/n y = f (x) h h a a+h a+2h a+(n-1)h b x 1: 1 x h = (b a)/n [x i, x i+1 ] = [a+i h, a+ (i + 1) h] A(x

More information

ohp08.dvi

ohp08.dvi 19 8 ( ) 2019.4.20 1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: 2 (2) NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( 2) 3 (3) head cur tail head cur prev data

More information

解きながら学ぶC++入門編

解きながら学ぶC++入門編 !... 38!=... 35 "... 112 " "... 311 " "... 4, 264 #... 371 #define... 126, 371 #endif... 369 #if... 369 #ifndef... 369 #include... 3, 311 #undef... 371 %... 17, 18 %=... 85 &... 222 &... 203 &&... 40 &=...

More information

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D 6 2019 5 14 6.1 Minimum C....................... 6 1 6.2....................................... 6 7 6.1 Minimum C Minimum C BNF T okenseq W hite Any Digit ::= 0 1 2... 9. Number ::= Digit Digit. Alphabet

More information

Prog1_6th

Prog1_6th 2012 年 5 月 24 日 ( 木 ) 実施 多分岐のプログラム 前回は多段階の 2 分岐を組み合わせて 3 種類以上の場合分けを実現したが, 式の値の評価によって, 一度に多種類の場合分けを行う多分岐の利用によって見通しのよいプログラムを作成できる場合がある ( 流れ図は右図 ) 式の評価 : 値 1 : 値 2 : 値 n : 該当値無し 処理 1 処理 2 処理 n 既定の処理 switch

More information

human_sample.cpp 1 /** 2 *** キャラクタアニメーションのための人体モデルの表現 基本処理ライブラリ サンプルプログラム 3 *** Copyright (c) 2015-, Masaki OSHITA ( 4 *** Released

human_sample.cpp 1 /** 2 *** キャラクタアニメーションのための人体モデルの表現 基本処理ライブラリ サンプルプログラム 3 *** Copyright (c) 2015-, Masaki OSHITA (  4 *** Released 1 /** 2 *** キャラクタアニメーションのための人体モデルの表現 基本処理ライブラリ サンプルプログラム 3 *** Copyright (c) 2015-, Masaki OSHITA (www.oshita-lab.org) 4 *** Released under the MIT license http://opensource.org/licenses/mit-license.php

More information

コンピュータグラフィックス特論Ⅱ

コンピュータグラフィックス特論Ⅱ コンピュータグラフィックス特論 Ⅱ 第 2 回 OpenGL プログラミングの基礎 九州工業大学尾下真樹 今日の内容 OpenGL プログラミングの基礎 C 言語 +OpenGL+GLUT によるプログラミング 座標変換の基礎 アフィン変換行列を使った視野変換の設定 いずれも 学部の講義 ( レベルの内容 ) の復習 今日の内容 OpenGL&GLUTの概要 サンプルプログラムの概要 座標変換 変換行列の設定

More information

卒 業 研 究 報 告.PDF

卒 業 研 究 報 告.PDF C 13 2 9 1 1-1. 1-2. 2 2-1. 2-2. 2-3. 2-4. 3 3-1. 3-2. 3-3. 3-4. 3-5. 3-5-1. 3-5-2. 3-6. 3-6-1. 3-6-2. 4 5 6 7-1 - 1 1 1-1. 1-2. ++ Lisp Pascal Java Purl HTML Windows - 2-2 2 2-1. 1972 D.M. (Dennis M Ritchie)

More information

新・明解C言語 ポインタ完全攻略

新・明解C言語 ポインタ完全攻略 2 1-1 1-1 /* 1-1 */ 1 int n = 100; int *p = &n; printf(" n %d\n", n); /* n int */ printf("*&n %d\n", *&n); /* *&n int */ printf(" p %p\n", p); /* p int * */ printf("&*p %p\n", &*p); /* &*p int * */ printf("sizeof(n)

More information

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * * 2015 2015 07 30 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) +

More information

XMPによる並列化実装2

XMPによる並列化実装2 2 3 C Fortran Exercise 1 Exercise 2 Serial init.c init.f90 XMP xmp_init.c xmp_init.f90 Serial laplace.c laplace.f90 XMP xmp_laplace.c xmp_laplace.f90 #include int a[10]; program init integer

More information

謗域・ュ逕ィppt

謗域・ュ逕ィppt 情報工学 217 年度後期第 4 回 [1 月 25 日 ] 静岡大学 工学研究科機械工学専攻ロボット 計測情報講座創造科学技術大学院情報科学専攻 三浦憲二郎 ローカル座標系による移動 講義アウトライン [1 月 25 日 ] ビジュアル情報処理 1.3.4 投影変換 1.3.5 いろいろな座標系と変換 OpenGL 投影変換 曲線の描画 トロコイド ( 外トロコイドと内トロコイド ) 頂点変換の手順

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² –

£Ã¥×¥í¥°¥é¥ß¥ó¥°(2018) - Âè11²ó – ½ÉÂꣲ¤Î²òÀ⡤±é½¬£² – (2018) 11 2018 12 13 2 g v dv x dt = bv x, dv y dt = g bv y (1) b v 0 θ x(t) = v 0 cos θ ( 1 e bt) (2) b y(t) = 1 ( v 0 sin θ + g ) ( 1 e bt) g b b b t (3) 11 ( ) p14 2 1 y 4 t m y > 0 y < 0 t m1 h = 0001

More information

1 3 2 OpenGL 4 3 OpenGL 5 4 OpenGL 6 OpenGl : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 6 : : : : : : : : : : : : : : : : : : : : :

1 3 2 OpenGL 4 3 OpenGL 5 4 OpenGL 6 OpenGl : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 6 : : : : : : : : : : : : : : : : : : : : : 1999 OpenGL S96M501 S96M596 S96M649 1 3 2 OpenGL 4 3 OpenGL 5 4 OpenGL 6 OpenGl : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 6 : : : : : : : : : : : : : : : : : : : : : 7 5 10 OpenGL :

More information

programmingII2019-v01

programmingII2019-v01 II 2019 2Q A 6/11 6/18 6/25 7/2 7/9 7/16 7/23 B 6/12 6/19 6/24 7/3 7/10 7/17 7/24 x = 0 dv(t) dt = g Z t2 t 1 dv(t) dt dt = Z t2 t 1 gdt g v(t 2 ) = v(t 1 ) + g(t 2 t 1 ) v v(t) x g(t 2 t 1 ) t 1 t 2

More information

謗域・ュ逕ィppt

謗域・ュ逕ィppt 情報工学 212 年度後期第 5 回 [1 月 31 日 ] 静岡大学 創造科学技術大学院情報科学専攻工学部機械工学科計測情報講座 三浦憲二郎 講義日程 第 8 回 11 月 21 日 ( 水 ) CG パート試験 講義アウトライン [1 月 31 日 ] ビジュアル情報処理 1.3.4 投影変換 1.3.5 いろいろな座標系と変換 OpenGL 投影変換 曲線の描画 トロコイド ( 外トロコイドと内トロコイド

More information

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* (

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* ( 2016 2016 07 28 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF : 11011 N N 0 N N 11 1001 N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) 1100100 (2) 1111011 (3) 1110010 (4) 1001011

More information

コンピュータグラフィックス特論Ⅱ

コンピュータグラフィックス特論Ⅱ 今日の内容 コンピュータグラフィックス特論 Ⅱ 第 2 回 OpenGL プログラミングの基礎 九州工業大学尾下真樹 OpenGL プログラミングの基礎 C 言語 +OpenGL+GLUT によるプログラミング 座標変換の基礎 アフィン変換行列を使った視野変換の設定 いずれも 学部の講義 ( レベルの内容 ) の復習 今日の内容 OpenGL&GLUTの概要 サンプルプログラムの概要 座標変換 変換行列の設定

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) { double

More information

1.ppt

1.ppt /* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)

More information

BW BW

BW BW Induced Sorting BW 11T2042B 2015 3 23 1 1 1.1................................ 1 1.2................................... 1 2 BW 1 2.1..................................... 2 2.2 BW.................................

More information

新・明解C言語 実践編

新・明解C言語 実践編 第 1 章 見 21 1-1 見えないエラー 見 List 1-1 "max2x1.h" a, b max2 List 1-1 chap01/max2x1.h max2 "max2x1.h" #define max2(a, b) ((a) > (b)? (a) : (b)) max2 List 1-2 List 1-2 chap01/max2x1test.c max2 #include

More information

PowerPoint Presentation

PowerPoint Presentation p.130 p.198 p.208 2 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i i < NUM; i++ ) ) if if ( weight[i] > max ) max = weight[i]: if if ( weight[i] < min ) min = weight[i]: weight

More information

Java演習(4) -- 変数と型 --

Java演習(4)   -- 変数と型 -- 50 20 20 5 (20, 20) O 50 100 150 200 250 300 350 x (reserved 50 100 y 50 20 20 5 (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; (reserved public class Blocks1 extends

More information

Graphics Performance Tuning () Z 2

Graphics Performance Tuning () Z 2 All Titles White, 54 Point, OpenGL Bold Italic, Performance Helvetica Narrow, 2 Point Leading Tuning Nihon Silicon Graphics K.K. Sales Division Graphics Grp Systems Engineer Takehiko Terada 1995/07/20

More information

joho07-1.ppt

joho07-1.ppt 0xbffffc5c 0xbffffc60 xxxxxxxx xxxxxxxx 00001010 00000000 00000000 00000000 01100011 00000000 00000000 00000000 xxxxxxxx x y 2 func1 func2 double func1(double y) { y = y + 5.0; return y; } double func2(double*

More information

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

K227 Java 2

K227 Java 2 1 K227 Java 2 3 4 5 6 Java 7 class Sample1 { public static void main (String args[]) { System.out.println( Java! ); } } 8 > javac Sample1.java 9 10 > java Sample1 Java 11 12 13 http://java.sun.com/j2se/1.5.0/ja/download.html

More information

イントロダクション

イントロダクション プログラミング演習 IV 第 8 回 OpenCV とテクスチャマッピング物体の発光や透過 埼玉大学情報システム工学科 小林貴訓 OpenCV PC で画像処理を行うライブラリ インテル社の画像処理ライブラリが起源 2000 年頃に最初のバージョン CPU でも画像処理ができることを見せたかった? Open 化して, 現在は Willow Garage( ウィロー ガレージ ) が開発を行っている

More information

44 6 MPI 4 : #LIB=-lmpich -lm 5 : LIB=-lmpi -lm 7 : mpi1: mpi1.c 8 : $(CC) -o mpi1 mpi1.c $(LIB) 9 : 10 : clean: 11 : -$(DEL) mpi1 make mpi1 1 % mpiru

44 6 MPI 4 : #LIB=-lmpich -lm 5 : LIB=-lmpi -lm 7 : mpi1: mpi1.c 8 : $(CC) -o mpi1 mpi1.c $(LIB) 9 : 10 : clean: 11 : -$(DEL) mpi1 make mpi1 1 % mpiru 43 6 MPI MPI(Message Passing Interface) MPI 1CPU/1 PC Cluster MPICH[5] 6.1 MPI MPI MPI 1 : #include 2 : #include 3 : #include 4 : 5 : #include "mpi.h" 7 : int main(int argc,

More information

char int float double の変数型はそれぞれ 文字あるいは小さな整数 整数 実数 より精度の高い ( 数値のより大きい より小さい ) 実数 を扱う時に用いる 備考 : 基本型の説明に示した 浮動小数点 とは数値を指数表現で表す方法である 例えば は指数表現で 3 書く

char int float double の変数型はそれぞれ 文字あるいは小さな整数 整数 実数 より精度の高い ( 数値のより大きい より小さい ) 実数 を扱う時に用いる 備考 : 基本型の説明に示した 浮動小数点 とは数値を指数表現で表す方法である 例えば は指数表現で 3 書く 変数 入出力 演算子ここまでに C 言語プログラミングの様子を知ってもらうため printf 文 変数 scanf 文 if 文を使った簡単なプログラムを紹介した 今回は変数の詳細について習い それに併せて使い方が増える入出力処理の方法を習う また 演算子についての復習と供に新しい演算子を紹介する 変数の宣言プログラムでデータを取り扱う場合には対象となるデータを保存する必要がでてくる このデータを保存する場所のことを

More information

double float

double float 2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................

More information

コンピュータグラフィックスS 演習資料

コンピュータグラフィックスS 演習資料 2015/5/26 コンピュータグラフィックスS 演 習 資 料 第 2 回 ポリゴンモデルの 描 画 九 州 工 業 大 学 情 報 工 学 部 システム 創 成 情 報 工 学 科 講 義 担 当 : 尾 下 真 樹 1. 準 備 : 前 回 の 演 習 本 日 の 演 習 は 前 回 の 演 習 で 作 成 したプログラムを 引 き 続 き 修 正 していく もし 前 回 の 演 習 を 行

More information

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D II 8 2003 11 12 1 6 ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 Daisuke 8 =>. 73 Daisuke 35 Hiroshi 64 Ichiro 87 Junko

More information

3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout <<

3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout << C++ C C++ 1 C++ C++ C C++ C C++? C C++ C *.c *.cpp C cpp VC C++ 2 C++ C++ C++ [1], C++,,1999 [2],,,2001 [3], ( )( ),,2001 [4] B.W. /D.M.,, C,,1989 C Web [5], http://kumei.ne.jp/c_lang/ 3 Hello World Hello

More information

C言語復習

C言語復習 著者 : 大和正武 生成日時 : 20151102-17:59 Copyright 2013 Red Hat, K.K. Copyright 2015 Red Hat, K.K. C 言語復習 The text of and illustrations in this document are licensed by Red Hat under a Creative

More information