Sunday, August 17, 2008

Sample program for basic OpenGL transformations....

I have created and uploaded a file for "Simple OpenGL transformation using GLUT".

အဲဒီ Program file ေလးထဲမွာ တတ္ႏိုင္သေလာက္ ရွင္းျပထားတဲ့ comment ေတြ ထည့္ေပးထားပါတယ္။
အဲဒီ file ေလးကို ဖြင့္ၾကည့္ ၿပီးေတာ့ GLUT နဲ႔ OpenGL ကို ဘယ္လို ေရးတယ္ ဆိုတာ နားလည္ႏုိင္မယ္ လုိ႔ ေမွ်ာ္လင့္ပါတယ္။ ကိုယ့္ရဲ႕ စက္ထဲမွာ OpenGL project တစ္ခုကို ပံုမွန္အတိုင္း ဖန္တီးၿပီးေတာ့ ကၽြန္ေတာ္ ေပးထားတဲ့ CPP file ထဲက code ေတြကို copy ကူးၿပီး run ၾကည့္ပါ။
ပထမ ကၽြန္ေတာ္ ရွင္းျပထားတဲ့ file က Microsoft Word format နဲ႔ ဆိုေတာ့ project ထဲကို ထည့္ရတာ အဆင္ မေျပမွာ စိုးလို႔ Plain Text (CPP) file ေလးလည္း ေပးထားပါတယ္။ Project ထဲကို copy ကူးထည့္ မယ္ဆိုရင္ အဲဒီ plain text (CPP) file ထဲက code ေတြကိုပဲ ကူးေပါ့။ Microsoft Word file ကေတာ့ ဖတ္ဖို႔၊ ေလ့လာဖို႔ သက္သက္ပါ။ ေအာက္မွာ link ေတြကို ေပးထားပါတယ္။
အဲဒီ CPP file ေလးကို ကၽြန္ေတာ္ Visual C++ 2005 နဲ႔ စမ္းၾကည့္ ထားၿပီးသားပါ။
တစ္ခု သတိထားရမွာက အဲဒီ program ကို run ရင္ ကၽြန္ေတာ္က "knot.m" ဆိုတဲ့ model file ေလးကို function ထဲကေန လွမ္းဖြင့္ ထားတဲ့အတြက္ အဲဒီ file ေလးကို project folder ထဲမွာပဲ ျဖစ္ျဖစ္၊ ဒါမွမဟုတ္ project ရိွေနတဲ့ folder ထဲက Debug ဆိုတဲ့ folder ထဲကိုပဲ ျဖစ္ျဖစ္ ထည့္ေပးထားဖုိ႔ လိုပါတယ္။
Knot.m မွ မဟုတ္ပါဘူး။ အဲဒီ program ထဲက OpenFile ဆိုတဲ့ function ထဲမွာ တစ္ျခား model file ကို ေျပာင္းၿပီး စမ္းၾကည့္လို႔ ရပါတယ္။ ျဖစ္ႏိုင္ရင္ "cap.m" ကို ေျပာင္းစမ္းၾကည့္ ေစခ်င္ပါတယ္။
ဒါမွ မဟုတ္ Model file ေတြကို သပ္သပ္ တစ္ေနရာရာမွာ သိမ္းထားတယ္ ဆိုရင္ အဲဒီ OpenFile ဆိုတဲ့ function ထဲက file path မွာ စိတ္ၾကိဳက္ ေျပာင္းေပးလို႔လည္း ရပါတယ္။
ဥပမာ- fp = fopen ( "c:\\models\\cap.m", "r" ); ဆိုတာ မ်ိဳးေပါ့။

ေအာက္မွာ ေပးထားတဲ့ link မွာ ကၽြန္ေတာ့ program file ရဲ႕ Microsoft word format ကို ယူလို႔ရပါတယ္။
http://www.4shared.com/file/59347629/2d268381/Simple_OpenGL_Transformation.html

Program file ရဲ႕ CPP format ကို ဒီမွာ ယူပါ....
http://www.4shared.com/file/59349679/b08e00f7/SimpleGLUT.html

0 comments:

Post a Comment