Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
groupcs7
Search
Kittixai
February 24, 2013
Programming
21
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
groupcs7
Mouse change color
Kittixai
February 24, 2013
Other Decks in Programming
See All in Programming
ジョジョの世界をXRで再現する
mofurune
0
160
Workers Cache を知る
syumai
0
360
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
410
AmebaブログはKMPから卒業します
kmars0605
0
190
残高管理から台帳サービスへの進化
artoy
1
200
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
470
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
380
APNsからLive Activityを開始する話
yumnumm
0
170
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
590
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.2k
Featured
See All Featured
エンジニアに許された特別な時間の終わり
watany
109
250k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
570
Scaling GitHub
holman
464
140k
How STYLIGHT went responsive
nonsquared
100
6.3k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
500
How to Talk to Developers About Accessibility
jct
2
580
Intergalactic Javascript Robots from Outer Space
tanoku
273
28k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
780
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Become a Pro
speakerdeck
PRO
31
6.3k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
640
Documentation Writing (for coders)
carmenintech
77
5.6k
Transcript
ສາທາລະນະລັດ ປະຊາທິປະໄຕ ສັນຕິພາບ ເອກກະລາດ ປະຊາທິປະໄຕ ເອກກະພາບ ປະຊາຊົນລາວ ບົດລາຍງານ ວິຊາຄອມພິວເຕີກຣາຟິກ ຫົວຂ
ໍ້: Mouse change Colors
ອຈສອນ: ອາຈານ ນິລັນກຸນ ຊ ື່ກື່ ຸມ groupcs7 ທ້າວ ກິດຕິໄຊ ຫານລອດຊົມພູ
ທ້າວ ທິລະສັກ ແກ້ວຫຼວງ ນາງ ພອນວິໄລ ນາງ ປານອມມິດ ສົກຮຽນ 2012-2013
ພາກສະເໜີ ການເອ ີ້ນໃຊີ້ libary ແລະ ການປະກາດຕົວປ່ຽນ #include <Windows.h> //include
libary #include <Gl/glut.h> #include <math.h> float diffuseMaterial[4] = { 0.5, 0.5, 0.5, 1.0 }; int wid,heg; ການສີ້າງ OBJECT void Drawucgen (float r) { glBegin(GL_TRIANGLES); //this draws triangle for(int ii = 0; ii < 360.00; ii++) //360 degree dots are taken { float theta = 2.0f * 3.1415926f * float(ii) / 90.00; float x = r * cosf(theta)*wid/heg; float y = r * sinf(theta)*heg/wid; glVertex2f(x+wid/2 , y+heg/2 );
glVertex2f(wid/2 , heg/2 ); } glEnd(); //draw end } void
init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_FLAT); } void display(void) { int v=0; glClear (GL_COLOR_BUFFER_BIT); Drawucgen(wid);//it depends on the screen width glPushMatrix(); glFlush ();// forces codes to work } ຟັງຊັນການປ່ຽນໂຄງສີ້າງ void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION);
glLoadIdentity (); gluOrtho2D (0.0, (GLdouble) w, 0.0, (GLdouble) h); wid=w;
heg=h; } ຟັງຊັນເມົີ້າຄລິກ void mouse(int button, int state, int x, int y) { switch (button) { case GLUT_LEFT_BUTTON: glClearColor (1.0, 1.0, 1.0,1.0); if (state == GLUT_DOWN) { /* change red */ diffuseMaterial[0] += 0.1; if (diffuseMaterial[0] > 1.0) diffuseMaterial[0] = 0.0; glColor4fv(diffuseMaterial); glutPostRedisplay(); } break; case GLUT_MIDDLE_BUTTON: glClearColor (0.0,2555.0,175.0,175.0); if (state == GLUT_DOWN) { /* change green */
diffuseMaterial[1] += 0.1; if (diffuseMaterial[1] > 1.0) diffuseMaterial[1] = 0.0;
glColor4fv(diffuseMaterial); glutPostRedisplay(); } break; case GLUT_RIGHT_BUTTON: glClearColor (255.0, 0.0, 0.0, 0.0); if (state == GLUT_DOWN) { /* change blue */ diffuseMaterial[2] += 0.1; if (diffuseMaterial[2] > 1.0) diffuseMaterial[2] = 0.0; glColor4fv(diffuseMaterial); glutPostRedisplay(); } break; default: break; } } ຟັງຊັນຄ ບອດເພ ່ອການປິດ
void keyboardx (GLubyte key, int x, int y) { switch
(key) { case 27: // ESC key to Exit exit(0); break; default: break; } } ຟັງຊັນການສີ້າງ, ສະແດງມ,ສິີ້ນສຸດການເຮັດວຽກ int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowSize (1000, 1000); glutInitWindowPosition (400,0); glutCreateWindow ("Mouse change Colors");
glutMouseFunc(mouse); glutKeyboardFunc(keyboardx); init (); glutDisplayFunc(display); glutReshapeFunc(reshape); glutMainLoop(); return 0; }
ໂປຣແກຣມນ ີ້ສາມາດປ່ຽນສ ດີ້ວຍການຄລິກເມົີ້າ ສາມາດປ ດໂປຣແກຣມດີ້ວຍການກ ົດປຸ່ມ Esc ພາກປະຕິບັດ ຜົນ Run ແລະ ວິທ ່ ການນ າໃຊີ້(ສາມາດປ່ຽນສ ພ ີ້ນ ຫຼັງແລະສ ຮູບໄດີ້ຫຼາຍສ ໂດຍການຄລິກເມົີ້າ)
ໜີ້າຕ່າງທ າອິດ ໜີ້າຕ່າງຄລິກເມົີ້າຊີ້າຍ
ໜີ້າຕ່າງຄລິກເມົີ້າຂວາ
ພາກສະຫ ຼຸບ 1. ສະຫຼຸບໂດຍຫຍ ້ ເຫັນວື່າໂປຣແກຣມນີ້ສາມາດປື່ຽນສີທັງສີພ ້ນຫຼັງແລະສີຮູບໄດ້ຫຼາຍສີເຊິື່ງສາມາດປື່ຽນໄດ້ດ້ວຍ ການຄລິກຊ້າຍຫຼ ຂວາແລ້ວຄລິກຫຼາຍໆຄັ້ງເພ ື່ອການປື່ຽນສີຫຼາຍໆສີ.
2. ແນວທາງໃນການພັດທະນາ ໃຫີ້ສີ້າງຄ ເພ ່ ອການປັບຂະໜາດຂອງໜີ້າຕ່າງ ສີ້າງຄ ເພ ່ ອຂະຫຍາຍຮູບແລະຫຍ ີ້ຮູບ ປັບແຕ່ງໃຫີ້ງາມຂ ີ້ນກວ່າເກົ່າ 3. ຂ ້ຄົງຄ້າງ ໂປຣແກຣມຍັງບ ສາມາດເພ ່ມລູກຫຼິີ້ນລຫຼາຍພ ສົມຄວນ ມ ັກມ ປັນຫາໃໃນການແກີ້ໄຂໂຄດ