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 - > - > - > - >

Size: px
Start display at page:

Download "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 - > - > - > - >"

Transcription

1 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 11 opencv_highgui240d.lib 12 opencv_video240d.lib 13 - > - > - > 14 ( ) 15 PATH=C:\opencv\build\x86\vc10\bin;C:\opencv\build\common\tbb\ia32\vc10;%PATH% 16 */ 17 #include <stdio.h> 18 #include <opencv2/opencv.hpp > int main(void) 21 { 22 // image 23 IplImage *image = cvcreateimage(cvsize(640,480), IPL_DEPTH_8U, 3); // p i c t u r e "sample.jpg" 26 IplImage *picture = cvloadimage("sample.jpg", CV_LOAD_IMAGE_COLOR); // p i c t u r e c I m a g e R e s u l t 29 cvresize(picture, image, CV_INTER_LINEAR); // "My Window" 32 cvnamedwindow ("My Window", CV_WINDOW_AUTOSIZE); cvshowimage("my Window", image); // image "My Window" cvwaitkey (0); // cvdestroyallwindows (); // return 0; 41 } 1

2 2. Program 2 (OpenGL Sample012) 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 11 opencv_highgui240d.lib 12 opencv_video240d.lib 13 - > - > - > 14 ( ) 15 PATH=C:\opencv\build\x86\vc10\bin;C:\opencv\build\common\tbb\ia32\vc10;%PATH% 16 */ 17 #include <stdio.h> #include <opencv2/opencv.hpp > #include <GL/glut.h> #define SQUARE_TEXTURE 1 24 #define SPHERE_TEXTURE // 27 static int MouseX = 0; // X 28 static int MouseY = 0; // Y 29 static float SpinX = 0; // X 30 static float SpinY = 0; // Y 31 static float Scale = 1.0; // static int MouseLB_ON=0; // 34 static int MouseRB_ON=0; // void mouse(int button, int state, int x, int y) 37 { 38 if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN){ 39 MouseLB_ON = 1; printf("(%3d,%3d) \ n", x, y); 40 }else if (button == GLUT_LEFT_BUTTON && state == GLUT_UP){ 41 MouseLB_ON = 0; printf("(%3d,%3d) \ n", x, y); 42 }else if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN){ 43 MouseRB_ON = 1; printf("(%3d,%3d) \ n", x, y); 44 }else if (button == GLUT_RIGHT_BUTTON && state == GLUT_UP){ 45 MouseRB_ON = 0; printf("(%3d,%3d) \ n", x, y); 46 } 47 } void dragmotion(int x, int y) 50 { 51 if (MouseLB_ON == 1){ 52 printf("(%3d,%3d)...\ n", x, y); 53 // 54 SpinX += x - MouseX; 55 SpinY += y - MouseY; 56 // 57 MouseX = x; 58 MouseY = y; 59 glutpostredisplay (); 60 } 61 else if (MouseRB_ON == 1){ 62 printf("(%3d,%3d)...\ n", x, y); 63 // 64 Scale += (float)(y - MouseY )/100; 65 // 66 MouseX = x; 67 MouseY = y; 68 glutpostredisplay (); 69 } 70 } void reshape(int w, int h) // R e s h a p e 73 { 74 glviewport(0, 0, w, h); glmatrixmode(gl_projection); 77 glloadidentity (); 78 gluperspective (30.0, (double)w/h, 1.0, 100.0); // glmatrixmode(gl_modelview); 81 glloadidentity (); 82 glulookat(5.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); // 83 } 84 2

3 85 void display(void) // D i s p l a y 86 { 87 glclearcolor(0.0, 0.0, 0.0, 1.0); // 88 glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); // 89 glenable(gl_depth_test); // // 92 glpushmatrix (); 93 glrotatef(spinx, 1.0, 0.0, 0.0); // X S p i n X 94 glrotatef(spiny, 0.0, 1.0, 0.0); // Y S p i n Y 95 glscalef(scale, Scale, Scale); // S c a l e glcalllist(square_texture); // A 98 //glcalllist(sphere_texture); // B 99 glpopmatrix(); // 102 glpushmatrix (); // X 103 GLfloat mat1diff[] = { 0.6, 0.2, 0.2, 1.0 }; // 104 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat1diff); 105 glnormal3f(0.0, 1.0, 0.0); // 106 glbegin(gl_lines); 107 glvertex3f (0.0f, 0.0f, 0.0f); 108 glvertex3f (2.0f, 0.0f, 0.0f); 109 glend(); 110 glpopmatrix(); 111 glpushmatrix (); // Y 112 GLfloat mat2diff[] = { 0.2, 0.6, 0.2, 1.0 }; // 113 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat2diff); 114 glnormal3f(0.0, 1.0, 0.0); // 115 glbegin(gl_lines); 116 glvertex3f (0.0f, 0.0f, 0.0f); 117 glvertex3f (0.0f, 2.0f, 0.0f); 118 glend(); 119 glpopmatrix(); 120 glpushmatrix (); // Z 121 GLfloat mat3diff[] = { 0.2, 0.2, 0.6, 1.0 }; // 122 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat3diff); 123 glnormal3f(0.0, 1.0, 0.0); // 124 glbegin(gl_lines); 125 glvertex3f (0.0f, 0.0f, 0.0f); 126 glvertex3f (0.0f, 0.0f, 2.0f); 127 glend(); 128 glpopmatrix(); glutswapbuffers (); // 131 } void lightinit(void) // ( ) 134 { 135 glenable(gl_lighting); // 136 glenable(gl_light0); //0 (8 ) 137 glenable(gl_normalize); // GLfloat light0pos[] = { 0.0, 5.0, 0.0, 1.0 }; 140 gllightfv(gl_light0, GL_POSITION, light0pos); // GLfloat light0ambi[] = { 0.2, 0.2, 0.2, 1.0 }; 143 gllightfv(gl_light0, GL_AMBIENT, light0ambi); // GLfloat light0diff[] = { 0.8, 0.8, 0.8, 1.0 }; 145 gllightfv(gl_light0, GL_DIFFUSE, light0diff); // GLfloat light0spec[] = { 0.5, 0.5, 0.5, 1.0 }; 147 gllightfv(gl_light0, GL_SPECULAR, light0spec); // glshademodel(gl_smooth); // 150 } // A( ) 153 void makemodela(unsigned char *image, int size_x, int size_y) 154 { 155 GLfloat white[] = { 1.0, 1.0, 1.0, 1.0 }; // GLuint texture; 158 glgentextures(1, &texture); // 159 glbindtexture(gl_texture_2d, texture); // ( ) gltexparameteri(gl_texture_2d,gl_texture_mag_filter,gl_linear); // ( ) 162 gltexparameteri(gl_texture_2d,gl_texture_min_filter,gl_linear); // ( ) 163 // 164 glubuild2dmipmaps(gl_texture_2d, 3, size_x, size_y, GL_RGB, GL_UNSIGNED_BYTE, image); /* ( ) */ 167 glnewlist(square_texture, GL_COMPILE); 168 glpushmatrix (); 169 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, white); 170 glenable(gl_texture_2d); 171 glbegin(gl_polygon); 172 glnormal3f(0.0, 1.0, 0.0); // 3

4 173 gltexcoord2f(0.0, 1.0); glvertex3f( 1.0, 0.0, 1.0); 174 gltexcoord2f(0.0, 0.0); glvertex3f(-1.0, 0.0, 1.0); 175 gltexcoord2f(1.0, 0.0); glvertex3f(-1.0, 0.0,-1.0); 176 gltexcoord2f(1.0, 1.0); glvertex3f( 1.0, 0.0,-1.0); 177 glend(); 178 gldisable(gl_texture_2d); 179 glpopmatrix(); 180 glendlist(); return; 183 } // B 186 void makemodelb(unsigned char *image, int size_x, int size_y) 187 { 188 GLfloat white[] = { 1.0, 1.0, 1.0, 1.0 }; // GLuint texture; 191 glgentextures(1, &texture); // 192 glbindtexture(gl_texture_2d, texture); // ( ) gltexparameteri(gl_texture_2d,gl_texture_mag_filter,gl_linear); // ( ) 195 gltexparameteri(gl_texture_2d,gl_texture_min_filter,gl_linear); // ( ) 196 // 197 glubuild2dmipmaps(gl_texture_2d, 3, size_x, size_y, GL_RGB, GL_UNSIGNED_BYTE, image); GLUquadricObj* sphere; 200 sphere = glunewquadric (); 201 gluquadricdrawstyle(sphere, GLU_FILL); 202 gluquadricnormals(sphere, GLU_SMOOTH); 203 gluquadrictexture(sphere, GL_TRUE); /* ( ) */ 206 glnewlist(sphere_texture, GL_COMPILE); 207 glpushmatrix (); 208 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, white); 209 glenable(gl_texture_2d); 210 glusphere(sphere, 1.0, 32, 32); 211 gldisable(gl_texture_2d); 212 glpopmatrix(); 213 glendlist(); return; 216 } int main(int argc, char *argv[]) 219 { 220 // OpenCV Initialize 221 // 222 IplImage *teximage = cvloadimage("texture.bmp",1); 223 unsigned char image [128][128][3]; 224 for(int x=0;x<128;x++){ 225 for(int y=0;y<128;y++){ 226 image[x][y][2]=teximage ->imagedata [128*y*3+x*3+0];/* B */ 227 image[x][y][1]=teximage ->imagedata [128*y*3+x*3+1];/* G */ 228 image[x][y][0]=teximage ->imagedata [128*y*3+x*3+2];/* R */ 229 } } // 232 cvnamedwindow("opencv Window", CV_WINDOW_AUTOSIZE ); 233 cvshowimage("opencv Window", teximage); 234 cvwaitkey (1); // OpenGL Initialize 237 glutinit(&argc, argv); // G L U T 238 glutinitdisplaymode(glut_rgba GLUT_DOUBLE GLUT_DEPTH); 239 glutinitwindowsize(640, 480); // 240 glutcreatewindow("window"); // 241 glutreshapefunc(reshape); // R e s h a p e 242 glutdisplayfunc(display); // D i s p l a y glutmousefunc(mouse); // 245 glutmotionfunc(dragmotion); // lightinit(); // ( ) makemodela((unsigned char *)image, 128, 128); // C G 250 makemodelb((unsigned char *)image, 128, 128); // C G // ( g l u t m y I d l e ) 253 glutmainloop (); // // OpenCV Finalize 256 cvdestroywindow( "OpenCV Window" ); return 0; 259 } 4

5 Program 3 (OpenGL Sample013) 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 11 opencv_highgui240d.lib 12 opencv_video240d.lib 13 - > - > - > 14 ( ) 15 PATH=C:\opencv\build\x86\vc10\bin;C:\opencv\build\common\tbb\ia32\vc10;%PATH% 16 */ 17 #include <stdio.h> #include <opencv2/opencv.hpp > #include <GL/glut.h> // ID 24 #define TEXTURE_STARS #define TEXTURE_EARTH // ID 28 #define SQUARE_TEXTURE 1 29 #define SPHERE_TEXTURE // 32 static int MouseX = 0; // X 33 static int MouseY = 0; // Y 34 static float SpinX = 0; // X 35 static float SpinY = 0; // Y 36 static float Scale = 1.0; // static int MouseLB_ON=0; // 39 static int MouseRB_ON=0; // void mouse(int button, int state, int x, int y) 42 { 43 if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN){ 44 MouseLB_ON = 1; printf("(%3d,%3d) \ n", x, y); 45 }else if (button == GLUT_LEFT_BUTTON && state == GLUT_UP){ 46 MouseLB_ON = 0; printf("(%3d,%3d) \ n", x, y); 47 }else if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN){ 48 MouseRB_ON = 1; printf("(%3d,%3d) \ n", x, y); 49 }else if (button == GLUT_RIGHT_BUTTON && state == GLUT_UP){ 50 MouseRB_ON = 0; printf("(%3d,%3d) \ n", x, y); 51 } 52 } void dragmotion(int x, int y) 55 { 56 if (MouseLB_ON == 1){ 57 printf("(%3d,%3d)...\ n", x, y); 58 // 59 SpinX += x - MouseX; 60 SpinY += y - MouseY; 61 // 62 MouseX = x; 63 MouseY = y; 64 glutpostredisplay (); 65 } 66 else if (MouseRB_ON == 1){ 67 printf("(%3d,%3d)...\ n", x, y); 68 // 69 Scale += (float)(y - MouseY )/100; 70 // 71 MouseX = x; 72 MouseY = y; 73 glutpostredisplay (); 74 } 75 } void reshape(int w, int h) // R e s h a p e 78 { 79 glviewport(0, 0, w, h); 80 glmatrixmode(gl_projection); 81 glloadidentity (); 82 gluperspective (30.0, (double)w/h, 1.0, 100.0); // glmatrixmode(gl_modelview); 85 glloadidentity (); 86 glulookat(5.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); // 87 } 5

6 88 89 void display(void) // D i s p l a y 90 { 91 glclearcolor(0.0, 0.0, 0.0, 1.0); // 92 glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); // 93 glenable(gl_depth_test); // // 96 glpushmatrix (); 97 gltranslatef(-1.0,0.0, -1.0); 98 glrotatef(45.0, 0.0, 1.0, 0.0); // Y S p i n Y 99 glscalef(3.0, 3.0, 3.0); // S c a l e 100 glbindtexture(gl_texture_2d, TEXTURE_STARS); // ( ) 101 glcalllist(square_texture); // A 102 glpopmatrix(); // 105 glpushmatrix (); 106 glrotatef(spinx, 1.0, 0.0, 0.0); // X S p i n X 107 glrotatef(spiny, 0.0, 1.0, 0.0); // Y S p i n Y 108 glscalef(scale, Scale, Scale); // S c a l e 109 glbindtexture(gl_texture_2d, TEXTURE_EARTH); // ( ) 110 glcalllist(sphere_texture); // B 111 glpopmatrix(); // 114 glpushmatrix (); // X 115 GLfloat mat1diff[] = { 0.6, 0.2, 0.2, 1.0 }; // 116 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat1diff); 117 glnormal3f(0.0, 1.0, 0.0); // 118 glbegin(gl_lines); 119 glvertex3f (0.0f, 0.0f, 0.0f); 120 glvertex3f (2.0f, 0.0f, 0.0f); 121 glend(); 122 glpopmatrix(); 123 glpushmatrix (); // Y 124 GLfloat mat2diff[] = { 0.2, 0.6, 0.2, 1.0 }; // 125 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat2diff); 126 glnormal3f(0.0, 1.0, 0.0); // 127 glbegin(gl_lines); 128 glvertex3f (0.0f, 0.0f, 0.0f); 129 glvertex3f (0.0f, 2.0f, 0.0f); 130 glend(); 131 glpopmatrix(); 132 glpushmatrix (); // Z 133 GLfloat mat3diff[] = { 0.2, 0.2, 0.6, 1.0 }; // 134 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat3diff); 135 glnormal3f(0.0, 1.0, 0.0); // 136 glbegin(gl_lines); 137 glvertex3f (0.0f, 0.0f, 0.0f); 138 glvertex3f (0.0f, 0.0f, 2.0f); 139 glend(); 140 glpopmatrix(); glutswapbuffers (); // 143 } void lightinit(void) // ( ) 146 { 147 glenable(gl_lighting); // 148 glenable(gl_light0); //0 (8 ) 149 glenable(gl_normalize); // GLfloat light0pos[] = { 0.0, 5.0, 0.0, 1.0 }; 152 gllightfv(gl_light0, GL_POSITION, light0pos); // GLfloat light0ambi[] = { 0.2, 0.2, 0.2, 1.0 }; 155 gllightfv(gl_light0, GL_AMBIENT, light0ambi); // GLfloat light0diff[] = { 0.8, 0.8, 0.8, 1.0 }; 157 gllightfv(gl_light0, GL_DIFFUSE, light0diff); // GLfloat light0spec[] = { 0.5, 0.5, 0.5, 1.0 }; 159 gllightfv(gl_light0, GL_SPECULAR, light0spec); // glshademodel(gl_smooth); // 162 } void loadtexture(void) 165 { 166 // O p e n C V 167 // 168 IplImage *_teximage1 = cvloadimage("texture1.jpg", 1); 169 // (( n )*( n ) ) 170 IplImage *teximage1 = cvcreateimage(cvsize(768,512), IPL_DEPTH_8U,3); 171 cvresize(_teximage1, teximage1); 172 cvflip(teximage1, teximage1, 0);// 173 cvcvtcolor(teximage1, teximage1, CV_BGR2RGB); // B G R R G B 174 cvnamedwindow("opencv Window 1", CV_WINDOW_AUTOSIZE ); 175 cvshowimage("opencv Window 1", _teximage1); cvwaitkey (1); 6

7 176 // 177 glbindtexture(gl_texture_2d, TEXTURE_STARS); // 178 gltexparameteri(gl_texture_2d,gl_texture_mag_filter,gl_linear); // ( ) 179 gltexparameteri(gl_texture_2d,gl_texture_min_filter,gl_linear); // ( ) 180 // 181 glubuild2dmipmaps(gl_texture_2d, 3, 768, 512, GL_RGB, GL_UNSIGNED_BYTE, teximage1 ->imagedata); 182 // 183 cvreleaseimage(&teximage1); // 186 IplImage *_teximage2 = cvloadimage("texture2.jpg", 1); 187 // (( n )*( n ) ) 188 IplImage *teximage2 = cvcreateimage(cvsize(1024,512), IPL_DEPTH_8U,3); 189 cvresize(_teximage2, teximage2); 190 cvflip(teximage2, teximage2, 0); // 191 cvcvtcolor(teximage2, teximage2, CV_BGR2RGB); // B G R R G B 192 cvnamedwindow("opencv Window 2", CV_WINDOW_AUTOSIZE ); 193 cvshowimage("opencv Window 2", _teximage2); cvwaitkey (1); 194 // 195 glbindtexture(gl_texture_2d, TEXTURE_EARTH); // 196 gltexparameteri(gl_texture_2d,gl_texture_mag_filter,gl_linear); // ( ) 197 gltexparameteri(gl_texture_2d,gl_texture_min_filter,gl_linear); // ( ) 198 // 199 glubuild2dmipmaps(gl_texture_2d, 3, 1024, 512, GL_RGB, GL_UNSIGNED_BYTE, teximage2 ->imagedata); 200 // 201 cvreleaseimage(&teximage2); return; 204 } // A( ) 207 void makemodela(void) 208 { 209 GLfloat white[] = { 1.0, 1.0, 1.0, 1.0 }; // /* ( ) */ 212 glnewlist(square_texture, GL_COMPILE); 213 glpushmatrix (); 214 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, white); 215 glenable(gl_texture_2d); 216 glbegin(gl_polygon); 217 glnormal3f(0.0, 1.0, 0.0); // 218 gltexcoord2f(1.0, 1.0); glvertex3f( 1.0, 1.0, 0.0); 219 gltexcoord2f(0.0, 1.0); glvertex3f(-1.0, 1.0, 0.0); 220 gltexcoord2f(0.0, 0.0); glvertex3f(-1.0, -1.0,0.0); 221 gltexcoord2f(1.0, 0.0); glvertex3f( 1.0, -1.0,0.0); 222 glend(); 223 gldisable(gl_texture_2d); 224 glpopmatrix(); 225 glendlist(); return; 228 } // B 231 void makemodelb(void) 232 { 233 GLfloat white[] = { 1.0, 1.0, 1.0, 1.0 }; // GLUquadricObj* sphere; 236 sphere = glunewquadric (); 237 gluquadricdrawstyle(sphere, GLU_FILL); 238 gluquadricnormals(sphere, GLU_SMOOTH); 239 gluquadrictexture(sphere, GL_TRUE); /* ( ) */ 242 glnewlist(sphere_texture, GL_COMPILE); 243 glpushmatrix (); 244 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, white); 245 glenable(gl_texture_2d); 246 glusphere(sphere, 1.0, 32, 32); 247 gldisable(gl_texture_2d); 248 glpopmatrix(); 249 glendlist(); return; 252 } int main(int argc, char *argv[]) 255 { //************************************************************* 258 // OpenGL Initialize 259 //************************************************************* 260 glutinit(&argc, argv); // G L U T 261 glutinitdisplaymode(glut_rgba GLUT_DOUBLE GLUT_DEPTH); 262 glutinitwindowsize(640, 480); // 263 glutcreatewindow("window"); // 7

8 264 glutreshapefunc(reshape); // R e s h a p e 265 glutdisplayfunc(display); // D i s p l a y glutmousefunc(mouse); // 268 glutmotionfunc(dragmotion); // lightinit(); // ( ) loadtexture(); // 273 makemodela(); // C G 274 makemodelb(); // C G //************************************************************* 277 // ( g l u t m y I d l e ) 278 //************************************************************* 279 glutmainloop (); // 280 // //************************************************************* 283 // OpenCV Finalize 284 //************************************************************* 285 cvdestroyallwindows (); return 0; 288 } 8

9 3. 1 #include <stdio.h> 2 #include <GL/glut.h> 3 4 // 5 static int MouseX = 0; // X 6 static int MouseY = 0; // Y 7 static float SpinX = 0; // X 8 static float SpinY = 0; // Y 9 static float MoveX = 0; // X 10 static float MoveZ = 0; // Y 11 static float Scale = 1.0; // 12 Program 4 (OpenGL Sample014) 13 void specialkey(int key, int x, int y) 14 { 15 switch (key) { 16 case GLUT_KEY_UP: 17 printf("(%3d,%3d) [ ] \ n", x, y); 18 MoveZ += 0.1; 19 break; 20 case GLUT_KEY_DOWN: 21 printf("(%3d,%3d) [ ] \ n", x, y); 22 MoveZ -= 0.1; 23 break; 24 case GLUT_KEY_LEFT: 25 printf("(%3d,%3d) [ ] \ n", x, y); 26 MoveX -= 0.1; 27 break; 28 case GLUT_KEY_RIGHT: 29 printf("(%3d,%3d) [ ] \ n", x, y); 30 MoveX += 0.1; 31 break; 32 } 33 glutpostredisplay (); 34 } static int MouseLB_ON=0; // 37 static int MouseRB_ON=0; // void mouse(int button, int state, int x, int y) 40 { 41 if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN){ 42 MouseLB_ON = 1; printf("(%3d,%3d) \ n", x, y); 43 }else if (button == GLUT_LEFT_BUTTON && state == GLUT_UP){ 44 MouseLB_ON = 0; printf("(%3d,%3d) \ n", x, y); 45 }else if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN){ 46 MouseRB_ON = 1; printf("(%3d,%3d) \ n", x, y); 47 }else if (button == GLUT_RIGHT_BUTTON && state == GLUT_UP){ 48 MouseRB_ON = 0; printf("(%3d,%3d) \ n", x, y); 49 } 50 } void dragmotion(int x, int y) 53 { 54 if (MouseLB_ON == 1){ 55 printf("(%3d,%3d)...\ n", x, y); 56 // 57 SpinX += x - MouseX; 58 SpinY += y - MouseY; 59 // 60 MouseX = x; 61 MouseY = y; 62 glutpostredisplay (); 63 } 64 else if (MouseRB_ON == 1){ 65 printf("(%3d,%3d)...\ n", x, y); 66 // 67 Scale += (float)(y - MouseY )/100; 68 // 69 MouseX = x; 70 MouseY = y; 71 glutpostredisplay (); 72 } 73 } void reshape(int w, int h) // R e s h a p e 76 { 77 glviewport(0, 0, w, h); glmatrixmode(gl_projection); 80 glloadidentity (); 81 gluperspective (30.0, (double)w/h, 1.0, 100.0); // glmatrixmode(gl_modelview); 84 glloadidentity (); 9

10 85 glulookat(5.0, 5.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); // 86 } void display(void) // D i s p l a y 89 { 90 glclearcolor(0.0, 0.0, 0.0, 1.0); // 91 glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); // 92 glenable(gl_depth_test); // // ( ) 95 glpushmatrix (); 96 GLfloat silver_ambient[] = { , , , 1.0}; 97 GLfloat silver_diffuse[] = { , , , 1.0}; 98 GLfloat silver_specular[] = { , , ,1.0}; 99 GLfloat silver_shininess []= {51.2}; 100 glmaterialfv(gl_front_and_back, GL_AMBIENT, silver_ambient); 101 glmaterialfv(gl_front_and_back, GL_DIFFUSE, silver_diffuse); 102 glmaterialfv(gl_front_and_back, GL_SPECULAR, silver_specular); 103 glmaterialfv(gl_front_and_back, GL_SHININESS,silver_shininess); 104 glmaterialfv(gl_front_and_back, GL_EMISSION, silver_diffuse);// 105 gltranslatef(0.0, 2.0, 0.0); // Y glutsolidsphere(0.2, 20.0, 20.0); // 107 GLfloat silver_emission_nomal[] = {0.0, 0.0, 0.0, 1.0}; 108 glmaterialfv(gl_front_and_back, GL_EMISSION, silver_emission_nomal); // 109 glpopmatrix(); // 112 glpushmatrix (); // X 113 GLfloat mat1diff[] = { 0.6, 0.2, 0.2, 1.0 }; 114 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat1diff); 115 glnormal3f(0.0, 1.0, 0.0); // 116 glbegin(gl_lines); 117 glvertex3f (0.0f, 0.0f, 0.0f); 118 glvertex3f (2.0f, 0.0f, 0.0f); 119 glend(); 120 glpopmatrix(); 121 glpushmatrix (); // Y 122 GLfloat mat2diff[] = { 0.2, 0.6, 0.2, 1.0 }; 123 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat2diff); 124 glnormal3f(0.0, 1.0, 0.0); // 125 glbegin(gl_lines); 126 glvertex3f (0.0f, 0.0f, 0.0f); 127 glvertex3f (0.0f, 2.0f, 0.0f); 128 glend(); 129 glpopmatrix(); 130 glpushmatrix (); // Z 131 GLfloat mat3diff[] = { 0.2, 0.2, 0.6, 1.0 }; 132 glmaterialfv(gl_front_and_back, GL_AMBIENT_AND_DIFFUSE, mat3diff); 133 glnormal3f(0.0, 1.0, 0.0); // 134 glbegin(gl_lines); 135 glvertex3f (0.0f, 0.0f, 0.0f); 136 glvertex3f (0.0f, 0.0f, 2.0f); 137 glend(); 138 glpopmatrix(); // 141 glenable(gl_blend); 142 // 143 glblendfunc(gl_src_alpha, GL_ONE); // ( ) 146 glpushmatrix (); 147 GLfloat green_plastic_ambient[] = {0.0, 0.0, 0.0, 1.0}; 148 GLfloat green_plastic_diffuse[] = {0.1, 0.35, 0.1, 1.0}; 149 GLfloat green_plastic_specular[] = {0.45, 0.55, 0.45, 1.0}; 150 GLfloat green_plastic_shininess []= {32}; 151 glmaterialfv(gl_front_and_back, GL_AMBIENT, green_plastic_ambient); 152 glmaterialfv(gl_front_and_back, GL_DIFFUSE, green_plastic_diffuse); 153 glmaterialfv(gl_front_and_back, GL_SPECULAR, green_plastic_specular); 154 glmaterialfv(gl_front_and_back, GL_SHININESS,green_plastic_shininess); 155 gltranslatef(0.0, 0.0, 1.0); // Z glutsolidsphere(0.5, 20.0, 20.0); // 157 glpopmatrix(); // ( ) 160 glpushmatrix (); 161 GLfloat ruby_ambient[] = {0.1745, , , 1.0}; 162 GLfloat ruby_diffuse[] = { , , , 1.0}; 163 GLfloat ruby_specular[] = { , , , 1.0}; 164 GLfloat ruby_shininess []= {76.8 }; 165 glmaterialfv(gl_front_and_back, GL_AMBIENT, ruby_ambient); 166 glmaterialfv(gl_front_and_back, GL_DIFFUSE, ruby_diffuse); 167 glmaterialfv(gl_front_and_back, GL_SPECULAR, ruby_specular); 168 glmaterialfv(gl_front_and_back, GL_SHININESS,ruby_shininess); 169 gltranslatef(1.0, 0.0, 0.0); // X glutsolidsphere(0.5, 20.0, 20.0); // 171 glpopmatrix();

11 173 // ( ) 174 glpushmatrix (); 175 GLfloat brass_ambient[] ={ , , , 0.5};// (0.5) 176 GLfloat brass_diffuse[] ={ , , , 0.5};// (0.5) 177 GLfloat brass_specular[] ={ , , , 0.5};// (0.5) 178 GLfloat brass_shininess []={ }; 179 glmaterialfv(gl_front_and_back, GL_AMBIENT, brass_ambient); 180 glmaterialfv(gl_front_and_back, GL_DIFFUSE, brass_diffuse); 181 glmaterialfv(gl_front_and_back, GL_SPECULAR, brass_specular); 182 glmaterialfv(gl_front_and_back, GL_SHININESS,brass_shininess); 183 gltranslatef(movex, 0.0, MoveZ); // X M o v e X Z M o v e Z 184 glrotatef(spinx, 1.0, 0.0, 0.0); // X S p i n X 185 glrotatef(spiny, 0.0, 1.0, 0.0); // Y S p i n Y 186 glscalef(scale, Scale, Scale); // S c a l e 187 // 188 glutsolidcube (2.0); 189 glpopmatrix(); gldisable(gl_blend); // glutswapbuffers (); // 194 } void lightinit(void) // ( ) 197 { 198 glenable(gl_lighting); // 199 glenable(gl_light0); //0 (8 ) 200 glenable(gl_normalize); // GLfloat light0pos[] = { 0.0, 2.0, 0.0, 1.0 };// Y 2.0 ( ) 203 gllightfv(gl_light0, GL_POSITION, light0pos); // GLfloat light0ambi[] = { 0.2, 0.2, 0.2, 1.0 }; 206 gllightfv(gl_light0, GL_AMBIENT, light0ambi); // GLfloat light0diff[] = { 0.8, 0.8, 0.8, 1.0 }; 208 gllightfv(gl_light0, GL_DIFFUSE, light0diff); // GLfloat light0spec[] = { 0.5, 0.5, 0.5, 1.0 }; 210 gllightfv(gl_light0, GL_SPECULAR, light0spec); // glshademodel(gl_smooth); // 213 } int main(int argc, char *argv[]) 216 { 217 glutinit(&argc, argv); // G L U T 218 glutinitdisplaymode(glut_rgba GLUT_DOUBLE GLUT_DEPTH); 219 glutinitwindowsize(640, 480); // 220 glutcreatewindow("window"); // 221 glutreshapefunc(reshape); // R e s h a p e 222 glutdisplayfunc(display); // D i s p l a y glutmousefunc(mouse); // 225 glutmotionfunc(dragmotion); // 226 glutspecialfunc(specialkey); // ( ) 227 //glutignorekeyrepeat(gl_true); // lightinit(); // ( ) glutmainloop (); // return 0; 234 } 11

#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

#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 1 1. 1 #include 2 #include 3 #include 4 Program 1 (OpenGL GameSample001) 5 // 6 static bool KeyUpON = false; // 7 static bool KeyDownON = false; // 8 static bool KeyLeftON

More information

イントロダクション

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

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

第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

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

/* 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

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

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

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

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

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

2 Eclipse 2.1 Eclipse 1. Eclipse 2. 3 ( 4) E:Yworkspace OK 3 Eclipse 4 3. Eclipse 5 5 Eclipse Eclipse 2. 7 C 2

2 Eclipse 2.1 Eclipse 1. Eclipse 2. 3 ( 4) E:Yworkspace OK 3 Eclipse 4 3. Eclipse 5 5 Eclipse Eclipse 2. 7 C 2 3: 1 1. PC 2. Phantasys 201209 ( 1) 1 PC 2 Windows 3. Windows ID ( 2) 4. Web (Firefox Internet Explorer) 5. A 6. http:// http://www.cv.ics.saitama-u.ac.jp/yosinori/lecture/seminar/ Web 1 7. USB PC USB

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

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

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

イントロダクション

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

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

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

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

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

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

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

謗域・ュ逕ィ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

$ 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

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 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

演算増幅器

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

More information

演算増幅器

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

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

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

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

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

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

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

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

TA TA TA abcdefgh abcdefgh C PC Wii bluetooth 2.2 Bluetooth USB Princeton PTM-UBT3S 1 1

TA TA TA abcdefgh abcdefgh C PC Wii bluetooth 2.2 Bluetooth USB Princeton PTM-UBT3S 1 1 1 22 (2) TA: 2010 12 13 1 OpenGL Wii Wii OpenGL USB (3DCG) 1.1 http://www.cyber.t.u-tokyo.ac.jp/~kuni/enshu2010/ URL USB 2 2 1.2 TA 16 15 TA TA mireport@cyber.t.u-tokyo.ac.jp 20101213 abcdefgh abcdefgh

More information

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

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

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

第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

( ) 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

$ 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

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

コンピュータグラフィックスS 演習資料 コンピュータグラフィックス S 演習資料 第 4 回シェーディング マッピング 九州工業大学情報工学部システム創成情報工学科講義担当 : 尾下真樹 1. 演習準備 今回の演習も 前回までの演習で作成したプログラムに続けて変更を行う まずは シェーディングの演習のため 描画処理で 回転する一つの四角すいを描画するように変更する 画面をクリア ( ピクセルデータと Z バッファの両方をクリア ) glclear(

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

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

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

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

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

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

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

コンピュータグラフィクス論 コンピュータグラフィクス論 2015 年 4 月 9 日 高山健志 教員紹介 高山健志 ( 国立情報学研究所特任助教 ) http://research.nii.ac.jp/~takayama/ takayama@nii.ac.jp 蜂須賀恵也 ( 創造情報学専攻講師 ) http://www.ci.i.u-tokyo.ac.jp/~hachisuka/ thachisuka@siggraph.org

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

‚æ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

スライド 1

スライド 1 知能制御システム学 画像処理の基礎 (1) 基礎概念と OpenCV の導入 東北大学大学院情報科学研究科鏡慎吾 swk(at)ic.is.tohoku.ac.jp http://www.ic.is.tohoku.ac.jp/~swk/lecture/ 2012.06.12 ディジタル画像 撮像面における入射光強度のアナログ分布 2 次元離散化 ( 画素 への分割 ) 量子化 (A/D 変換 ) ディジタル画像

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

PowerPoint Presentation

PowerPoint Presentation 8-1 8. テクスチャマッピング 8.1. テクスチャマッピングの原理 狭義には, 図のように, 与えられた画像を物体に貼り付ける方法. マッピングには投影法, 極座標変換, パラメータマッピングなどがある (1 年 コンピュータ グラフィックス ). 広義にはバンプマッピングなども含まれる. t y s z x 8-2 8.2. テクスチャマッピングの設定方法 全体の流れ 1) 原図ビットマップデータを内部形式に変換

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

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

コンピュータグラフィクス論 コンピュータグラフィクス論 2016 年 4 月 7 日 高山健志 教員紹介 高山健志 ( 国立情報学研究所特任助教 ) http://research.nii.ac.jp/~takayama/ takayama@nii.ac.jp 蜂須賀恵也 ( 創造情報学専攻講師 ) http://www.ci.i.u-tokyo.ac.jp/~hachisuka/ thachisuka@siggraph.org

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

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

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

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

: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

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

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

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

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

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

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

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

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

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

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裶²ó  ¨¡ À©¸æ¹½Â¤¡§·«¤êÊÖ¤· ¨¡ (2018) 2018 5 24 ( ) while ( ) do while ( ); for ( ; ; ) while int i = 0; while (i < 100) { printf("i = %3d\n", i); i++; while int i = 0; i while (i < 100) { printf("i = %3d\n", i); i++; while int i =

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

謗域・ュ逕ィppt

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

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

謗域・ュ逕ィppt

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

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

新・明解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

NB

NB JAPLA 研究会資料 2010/2/27 J の OpenGL グラフィックス - その 7 - フラー ドームと照光表示 - 西川利男 0. はじめに OpenGL 正多面体グラフィックスとして 今回はフラー ドームに挑戦してみた バックミンスター フラー (Richard Buckminster Fuller, 1895-1983 は多才な建築家 科学者 思想家として知られ その名前を冠した

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

£Ã¥×¥í¥°¥é¥ß¥ó¥°(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

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

C言語によるアルゴリズムとデータ構造

C言語によるアルゴリズムとデータ構造 Algorithms and Data Structures in C 4 algorithm List - /* */ #include List - int main(void) { int a, b, c; int max; /* */ Ÿ 3Ÿ 2Ÿ 3 printf(""); printf(""); printf(""); scanf("%d", &a); scanf("%d",

More information

para02-2.dvi

para02-2.dvi 2002 2 2002 4 23 : MPI MPI 1 MPI MPI(Message Passing Interface) MPI UNIX Windows Machintosh OS, MPI 2 1 1 2 2.1 1 1 1 1 1 1 Fig. 1 A B C F Fig. 2 A B F Fig. 1 1 1 Fig. 2 2.2 Fig. 3 1 . Fig. 4 Fig. 3 Fig.

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

プログラミング基礎

プログラミング基礎 C プログラミング Ⅰ 条件分岐 if~else if~else 文,switch 文 条件分岐 if~else if~else 文 if~else if~else 文 複数の条件で処理を分ける if~else if~else 文の書式 if( 条件式 1){ 文 1-1; 文 1-2; else if( 条件式 2){ 文 2-1; 文 2-2; else { 文 3-1; 文 3-2; 真条件式

More information

slide5.pptx

slide5.pptx ソフトウェア工学入門 第 5 回コマンド作成 1 head コマンド作成 1 早速ですが 次のプログラムを head.c という名前で作成してください #include #include static void do_head(file *f, long nlines); int main(int argc, char *argv[]) { if (argc!=

More information

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 1. 1.1. 1.2. 1 PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 2. 2.1. 2 1 2 C a b N: PC BC c 3C ac b 3 4 a F7 b Y c 6 5 a ctrl+f5) 4 2.2. main 2.3. main 2.4. 3 4 5 6 7 printf printf

More information

_openglcl

_openglcl 0 0 GPU Graphics Processing Unit CG GPU CG CG GPU OpenGL/GLSL CG D CG D CG GPU CG D CG D CG GPU CG GPU GPGPU General-Purpose computing on Graphics Processing Units GPU GPGPU OpenCL OpenCL OpenGL Windows

More information

Prog1_6th

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

More information

沼津工業高等専門学校

沼津工業高等専門学校 VisualStudio2010 を用いた OpenGL(Glut) コンソール アプリケーションの作成方法 初版 : 2007.01.06 藤尾 改訂 : 2010.08.24 秋山 - 1 - - 目次 - Ⅰ. プログラミングの準備 3 Ⅰ.1 はじめに 3 Ⅰ.2 OpenGL の環境設定 3 Ⅱ. プログラミングの第 1 歩 ( 簡単なプログラムの作成 ) 3 Ⅱ.1 プロジェクトの作成と保存

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 2017 2017 08 03 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF X [ S ] a S S ; X X X, S [, a, ], ; BNF X (parse tree) (1) [a;a] (2) [[a]] (3) [a;[a]] (4) [[a];a] : [a] X 2 222222

More information

19_OpenGLES.key

19_OpenGLES.key CS193P - Lecture 19 iphone Application Development OpenGL ES 1 Announcements Final projects due in 7 days Tuesday, March 16th 11:59 pm Submit: Code Power-point/Keynote slides ReadMe file Final project

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

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

新版明解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

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

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます.  このサンプルページの内容は, 新装版 1 刷発行時のものです. C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/009383 このサンプルページの内容は, 新装版 1 刷発行時のものです. i 2 22 2 13 ( ) 2 (1) ANSI (2) 2 (3) Web http://www.morikita.co.jp/books/mid/009383

More information