[CG]์‹œ์ ๋ณ€ํ™˜
ยท
Hi๐Ÿ–๏ธ/Computer_Graphics
ํ‚ค๋ณด๋“œ๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ์นด๋ฉ”๋ผ์˜ ์‹œ์ ์„ ๋ฐ”๊พธ๋Š” ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค. #include static float C_x, C_y, C_z = 2; static int rotateX = 0, rotateX_ = 0, rotateY = 0, rotateY_ = 0, rotateZ = 0, rotateZ_ = 0; void InitLight() { GLfloat mat_diffuse[] = { 0.5, 0.4, 0.3, 1.0 }; //GLfloat๋Š” ๋ณ€์ˆ˜ ํƒ€์ž…๋ช… ์„ค์ •ํ•˜๋Š”๊ฒƒ. GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat mat_ambient[] = { 0.5, 0.4, 0.3, 1.0 }; GLfloat mat_shininess[] = { 15.0 }; GLfloat li..
[CG] ํƒœ์–‘๊ณ„ ๋ชจ๋ธ๋ง
ยท
Hi๐Ÿ–๏ธ/Computer_Graphics
OpenGL๋กœ ๋งŒ๋“  ํƒœ์–‘๊ณ„ ๋ชจ๋ธ๋ง์ž…๋‹ˆ๋‹ค. ์•„๋ž˜๋Š” ์ „์ฒด ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค. #include //#include //#include static int Day = 0, Time = 0; void MyDisplay() { glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glColor3f(1.0, 0.3, 0.3); glutWireSphere(0.2, 20, 16);//ํƒœ์–‘๊ทธ๋ฆฌ๊ธฐ glPushMatrix();//ํƒœ์–‘๊ธฐ์ค€ ์ขŒํ‘œ๊ณ„ ์Šคํƒ์— ํ‘ธ์‹œํ•˜์—ฌ ์ €์žฅ glRotatef((GLfloat)Day, 0.0, 1.0, 0.0);//ํšŒ์ „ glTranslatef(0.7, 0.0, 0.0);//์ด๋™ glRotatef((GLfloat)Time, 0.0..
Computer Graphics
ยท
Hi๐Ÿ–๏ธ/Computer_Graphics
------------------------- OpenGL๋กœ ๋ฐฐ์šฐ๋Š” ์ปดํ“จํ„ฐ๊ทธ๋ž˜ํ”ฝ์Šค์˜ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•˜์˜€์Šต๋‹ˆ๋‹ค. ๋‘ ๋ฒกํ„ฐ๊ฐ€ ์ˆ˜์ง์ด๋ฉด ๋‚ด์ ์˜ ๊ฐ’์€ 0. ์™ธ์ ์˜ ๊ฐ’์€ 1. ์ „๋ฉด : ๋ฒ•์„  ๋ฒกํ„ฐ๊ฐ€ ์‹œ์ ์„ ํ–ฅํ•œ ๋ฉด ํ›„๋ฉด : ๋ฉ€์–ด์ง€๋Š” ๋ฐฉํ–ฅ ๋ฒ•์„ ๋ฒกํ„ฐ ๋ฉด. ์ ˆ๋‹จ - ๋ฌผ์ฒด๋ฉด ์ค‘ ๊ฐ€์‹œ ๋ถ€ํ”ผ ๋‚ด๋ถ€์— ์กด์žฌํ•˜๋Š” ๋ฉด๋งŒ ๊ฑธ๋Ÿฌ๋‚ด๋Š” ์ž‘์—…. (4์ฐจ์› ์ ˆ๋‹จ ์ขŒํ‘œ๊ณ„์—์„œ ์ผ์–ด๋‚จ) Ø 3์ฐจ์› ์ •๊ทœํ™” ์žฅ์น˜ ์ขŒํ‘œ๊ณ„์—์„œ ์ ˆ๋‹จํ•˜๋ฉด ์‹œ์  ๋’ค์ชฝ ๋ฌผ์ฒด ์ฒ˜๋ฆฌ ์‹œ ์˜ค๋ฅ˜ ๋ฐœ์ƒํ•ด์„œ. ์€๋ฉด์ œ๊ฑฐ - ์•ž๋ฉด์— ๊ฐ€๋ ค์„œ ๋ณด์ด์ง€ ์•Š๋Š” ๋ถ€๋ถ„ ์ œ๊ฑฐ ํ›„๋ฉด - ๋ฉด์ด ์„œ์žˆ๋Š” ๋ฐฉํ–ฅ ๋•Œ๋ฌธ์— ๋ณด์ด์ง€ ์•Š๋Š” ๋ฉด. ์‹œ์ ์—์„œ ๋ฉ€์–ด์ง€๋Š” ๋ฐฉํ–ฅ์˜ ๋ฒ•์„ ๋ฒกํ„ฐ ์ง€๋‹Œ ๋ฉด. ์ ˆ๋‹จ์•Œ๊ณ ๋ฆฌ์ฆ˜ 3๊ฐœ - ์ฝ”ํ—จ-์„œ๋”๋Ÿฐ๋“œ n ๋ฌผ์ฒด ์ขŒํ‘œ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ ˆ๋‹จํ•œ๋‹ค๋Š” ์ ์—์„œ ๋ฌผ์ฒด ๊ณต๊ฐ„ ์•Œ๊ณ ๋ฆฌ์ฆ˜. n ์ด์›ƒ์ฝ”๋“œ์— ์˜ํ•ด ์ ˆ๋‹จ ์—ฐ์‚ฐ์†๋„ ๋†’์ธ ๊ฒƒ..
Liky
'Hi๐Ÿ–๏ธ/Computer_Graphics' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก