Functions API useful in the OpenGL/GLUT


Các API sử dụng trong OpenGL/GLUT

Thấy anh em Cviệt rủ nhau cái vụ này và cu Kim nó chịu khó quá
X hơi rảnh tí thu gom một tí API cho anh em tham khảo.


Cac API su dung trong OpenGL

1. Khoi tao chuong trinh dung GLUT
void glutInit(int *argc, char **argv);
Tham so: argc va argv truyen vao tu ham ‘main()’

2. Thiet lap vi tri cua so
void glutInitWindowPosition(int x, int y)
Tham so: toa do cua so tu goc trai tren cung

3. Thiet lap kich thuoc cua so
void glutInitWindowSize(int width, int height)
Tham so:
width – chieu rong cua so
height – chieu dai cua so

4. Thiet lap che do man hinh
void glutInitDisplayMode(int mode)
Tham so:
mode – che do man hinh
Cac kieu che do mode duoc dinh nghia san
a. Che do mau sac
GLUT_RGBA (mac dinh)
b. Che do rai (buffer mode)
c. Che do cac kieu rai

De su dung ket hop cac che do voi nhau, su dung toan tu bitwise OR (|).
Vi du: glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA );
tuc la thiet lap man hinh che so sau kieu rai kep o che do RGBA

5. Thiet lap cua so
void glutCreateWindow(char* title)
Tham so:
title – tieu de cua cua so

6. Quy dinh ham xu ly ve man hinh (rendering)
void glutDisplayFunc(void (*func)(void))
Tham so:
(*func)() – con tro toi ham xu ly render
Chu y: bat buoc phai co, khong duoc truyen vao tham so NULL (gay ra crash)

7. Giu chuong trinh chay lien tuc
void glutMainLoop()

8. Ham xu ly khi cua so bi thay doi
void glutReshapeFunc(void (*func)(void))
Tham so:
(*func)() – con tro toi ham xu ly cua so

9. Ham xu ly khi cua so o che do tinh (Idle)
void glutIdleFunc(void (*func)(void))
Tham so:
(*func)() – con tro toi ham xu ly

10. Ham goi trinh xu ly rai doi (double buffering)
void glutSwapBuffers();

11. Ham xu ly tu ban phim voi cac ki tu nhan biet duoc duoi ma ASCII
void glutKeyboardFunc(void (*func) (unsigned char key, int x, int y))
Tham so
(*func)(unsigned char key, int x, int y) – con tro toi ham xu ly
key – ki tu vao
x – toa do x cua chuot (hoanh do)
y – toa do y cua chuot (tung do)

12. Ham xu ly cac ki tu tren ban phim ma nhan biet duoc duoi ma ASCII
void glutSpecialFunc(void (*func)(int key, int x, int y)
Tham so:
tuong tu glutKeyboardFunc() nhung key duoc dinh nghia san la 1 trong so
nhung ma sau:

GLUT_KEY_LEFT Left function key
GLUT_KEY_RIGHT Up function key
GLUT_KEY_UP Right function key
GLUT_KEY_DOWN Down function key
GLUT_KEY_PAGE_UP Page Up function key
GLUT_KEY_PAGE_DOWN Page Down function key
GLUT_KEY_HOME Home function key
GLUT_KEY_END End function key
GLUT_KEY_INSERT Insert function key

13. Ham xu li cac ki tu tren ban phim duoi dang to hop (combination keys)
int glutGetModifiers();
Gia tri tra ve la 1 trong 3 phim duoc dinh nghia san

14. Thiet lap che do lap di lap lai cho ban phim (repeat key mode)
int glutSetKeyRepeat(int repeatMode)
Tham so:
repeatMode – duoc dinh nghia san voi 3 che do sau

15. Mot ham khac tuong tu glutSetKeyRepeat() va an toan hon
int glutIgnoreKeyRepeat(int repeatMode)
Tham so
repeatMode – duoc dinh nghia voi 2 gia tri
1 – tu dong lap (auto-repeat)
0 – dung qua trinh lap (non-repeat)

16. Ham kiem tra neu phim thuong duoc nha ra (key release)
void glutKeyboardUpFunc(void (*func)(unsigned char key, int x, int y))

17. Tuong tu glutKeyboardUpFunc() nhung voi cac phim dac biet
void glutSpecialUpFunc(void (*func)(int key, int x, int y))

18. Ham xu ly su kien chuot
void glutMouseFunc(void (*func)(int button, int state, int x, int y))
Tham so:
(*func)(int button, int state, int x, int y) – con tro toi ham xu ly chuot
button – nut chuot duoc an, duoc dinh nghia voi 3 kieu sau
state – trang thai nut chuot duoc dinh nghia voi 2 kieu
x – hoanh do cua chuot
y – tung do cua chuot

19. Ham xu ly chuyen dong chuot o trang thai dong va trang thai tinh
void glutMotionFunc(void (*func)(int x, int y))
void glutPassiveMotionFunc(void (*func)(int x, int y))

20. Ham kiem tra hanh vi chuot vao cua so hay roi cua so
void glutEntryFunc(void (*func)(int state))
Tham so:
(*func)(int state) – con tro xu ly trang thai chuot
state – trang thai chuot so voi cua so, duoc dinh nghia voi 2 kieu

21. Tao menu
int glutCreateMenu(void (*func)(int value))
Tham so:
(*func)(int value) – con tro toi ham xu ly su kien tao menu

22. Them mot item vao menu
void glutAddMenuEntry(char* name, int value)
Tham so:
name – ten menu
value – gia tri thiet lap de su dung khi goi

23. Gan menu vao nut chuot
void glutAttachMenu(int button)
Tham so:
button – nut chuot duoc gan menu vao, duoc dinh nghia voi 3 kieu nut o tren

24. Go menu ra khoi nut
void glutDetachMenu(int button)
tuong tu glutAttachMenu()

25. Xoa menu di
void glutDestroyMenu(int menuIdentifier)
Tham so:
menuIdentifier – id cua menu khi tao qua glutCreateMenu()

Trả  lời cùng với trích dẫn

Cũ 24-03-2009, 09:32 AM

Avatar củaleedeblade

Mặc  định

Re: [Tra cứu] Các API sử dụng trong OpenGL/GLUT


72 Responses to Functions API useful in the OpenGL/GLUT

  1. Hi there, I discovered this blog once, then lost it. Took me forever to occur back and discover it. I wanted to view what comments you got. Great blog by the way.

  2. Zoila Seirer says:

    Let me reply to the particular writer who actually outlined wholesale gold bullion. It is very difficult to acquire a decent wholesale gold bars. supplier, however I would certainly endorse HWG.

  3. porn tube says:

    Love is an irresistible desire to be irresistibly desired.

  4. Percy Delana says:

    i was reading about this in another blog

  5. I have been examinating out some of your articles and i can state clever stuff. I will definitely bookmark your site.

  6. howdy-do. i love your blog Functions API useful in the OpenGL/GLUT Phuongthengocdtt's Blog and will shurely make a link to on my site.

  7. I loved as much as you’ll receive carried out right here. The sketch is attractive, your authored material stylish. nonetheless, you command get bought an shakiness over that you wish be delivering the following. unwell unquestionably come further formerly again as exactly the same nearly a lot often inside case you shield this hike.

  8. Carmelo says:

    I’m serious in purchasing affiliate link on this web. If you please e-mail me with the costs. Thank you.

  9. french beds says:

    buenos dias. i enjoy reading your blog Functions API useful in the OpenGL/GLUT Phuongthengocdtt's Blog and will certainly make a link to on my site.

  10. shed designs says:

    Contemplating developing a shed? we have many plans!

  11. Great design, great opinions, fantastic website. one in a million. Exactly where did you obtain the template for your web-site or did you do it by yourself?

  12. Your use of such emphatic words in your article shows an intense excitement in what you are trying to convey. Keep up the good work! I will shurely post a link to on my site.

  13. I absolutely love your blog and find a lot of your post’s to be exactly I’m looking for. Would you offer guest writers to write content available for you? I wouldn’t mind writing a post or elaborating on most of the subjects you write about here. Again, awesome web log!

  14. Ok… bit of a quickchange, but would someone fully grasp anything pertaining to organic swimming pools? We were thinking of doing a pool conversion so I wondered whether or not it would be a big ordeal. So then back into the standard slated hot debates…

  15. There are different opinions on this. I enjoyed your viewpoint.

  16. I have got one idea for your blog site. It appears like right now there are a couple of cascading stylesheet issues when launching a selection of webpages within google chrome as well as opera. It is running okay in internet explorer. Possibly you can double check that.

  17. Very fantastic visual appeal on this website , I’d value it 10 10.

  18. shoes rack says:

    I make my living writing, but I am not nearly as good as you. I’m not sure I would have the focus to do all the homework you’ve done on this topic. This is great. I will shurely insert a link to on my site.

  19. Some truly fantastic info , Sword lily I found this.

  20. I was wondering where I could find info on this. Functions API useful in the OpenGL/GLUT Phuongthengocdtt's Blog saved me a lot of time. Please, keep it up!

  21. hehe, i had been thinking the same thing last week

  22. I’m just writing to let you understand what a brilliant discovery our daughter encountered browsing your site. She learned several details, with the inclusion of how it is like to possess a very effective teaching character to have many others very easily learn selected very confusing subject matter. You undoubtedly surpassed our own desires. Thanks for giving these effective, safe, edifying and as well as fun thoughts on that topic to Sandra.

  23. water alarm says:

    I’m so impressed with how well you have gathered and put together this article. It’s well formatted and written. Quality work like this is a rarity. I appreciate the information and I agree with you. I will most definitely insert a link to on my site.

  24. I think this internet site holds very superb written subject material blog posts.

  25. I saw something about this topic on TV last night. Great post.

  26. I genuinely enjoyed reading through this web site. I’ll undoubtedly put you in my favorites segment. real estate Delaware County

  27. I make my living writing, but I am not nearly as good as you. I’m not sure I would have the focus to do all the homework you’ve done on this topic. This is great. I will certainly make a link to on my site.

  28. Loving the information on this website , you have done outstanding job on the content .

  29. Knitting says:

    Enjoyed studying this, very good stuff, thanks .

  30. Pingback: San Diego Website Design

  31. Pingback: San Diego Web Design Company

  32. Great post and right to the point. I don’t know if this is really the best place to ask but do you people have any thoughts on where to employ some professional writers? Thank you 🙂

  33. I’ve just lately began a blog, the information you present on this blog has helpful to me tremendously. Thank you for all your time & work.

  34. I like your blog details! Undoubtedly an exquisite supply of data that is extraordinarily helpful. Cheers.

  35. Hey nice weblog, simply checking out some sites, appears a fairly good platform you are using. I’m presently using Drupal for a few of my sites but seeking to switch one of them over to a platform very much like yours as a test site.

  36. I’m still learning from you, while I’m improving myself. I certainly enjoy reading all that is posted on your site.Keep the tips coming. I enjoyed it!

  37. I like this post, enjoyed this one thanks for putting up.

  38. Mommy Blog says:

    Some really prize content on this web site , saved to favorites .

  39. Some truly great info , Sword lily I observed this.

  40. Zune News says:

    I like this weblog so much, saved to bookmarks .

  41. Pingback: best suv 2010

  42. Mastering to create a fundamental company site is just not rocket science, if it were then I’m rather certain that there will be much more rocket scientists about in addition to a ton a lot less net designers. We don’t intend this to infer that internet designers aren’t clever, we are just after all net designers ourselves.

  43. Ernest says:

    Absolutely indited content , Really enjoyed looking through .

  44. Ian Eck says:

    It is best to participate in a contest for the most effective blogs on the web. I’ll suggest this site!

  45. Oh my goodness! an incredible article dude. Thank you Nonetheless I’m experiencing challenge with ur rss . Don’t know why Unable to subscribe to it. Is there anybody getting identical rss downside? Anyone who knows kindly respond. Thnkx

  46. Youre so cool! I dont suppose Ive read anything like this before. So good to search out any person with some original ideas on this subject. realy thanks for starting this up. this web site is something that’s needed on the web, somebody with just a little originality. useful job for bringing one thing new to the internet!

  47. It’s arduous to search out educated people on this topic, but you sound like you recognize what you’re speaking about! Thanks

  48. I like to surf around the internet, often I will go to Stumble Upon and read and check stuff out… capped bust

  49. You got a very superb website, Sword lily I observed it through yahoo.

  50. Elma Bumm says:

    I like the efforts you have put in this, regards for all the great content .

  51. The other day, while I was at work, my sister stole my apple ipad and tested to see if it can survive a 30 foot drop, just so she can be a youtube sensation. My iPad is now destroyed and she has 83 views. I know this is completely off topic but I had to share it with someone!

  52. Insight Tour says:

    Some really nice stuff on this web site , I love it.

  53. I am usually to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and hold checking for brand new information.

  54. Area51 Blog says:

    I truly enjoy reading on this web site , it has excellent content .

  55. Heya! I just wanted to ask if you ever have any problems with hackers? My last blog (wordpress) was hacked and I ended up losing months of hard work due to no backup. Do you have any solutions to prevent hackers?

  56. Viagra says:

    A friend suggested your website and I should say that I completely adored reading it. Keep up the outstanding work! My site Generic Viagrae

  57. Having been in the Albuquerque Roofing business for over twenty years, and using several variations of “green” products during that time, I can tell you that the upfront costs are often too prohibitive in the end user’s eyes, and that economics are the biggest factor keeping green products out of the mainstream. Most people aren’t willing to put their money where their mouth is.

  58. Hello Web Admin, I noticed that your On-Page SEO is is missing a few factors, for one you do not use all three H tags in your post, also I notice that you are not using bold or italics properly in your SEO optimization. On-Page SEO means more now than ever since the new Google update: Panda. No longer are backlinks and simply pinging or sending out a RSS feed the key to getting Google PageRank or Alexa Rankings, You now NEED On-Page SEO. So what is good On-Page SEO?First your keyword must appear in the title.Then it must appear in the URL.You have to optimize your keyword and make sure that it has a nice keyword density of 3-5% in your article with relevant LSI (Latent Semantic Indexing). Then you should spread all H1,H2,H3 tags in your article.Your Keyword should appear in your first paragraph and in the last sentence of the page. You should have relevant usage of Bold and italics of your keyword.There should be one internal link to a page on your blog and you should have one image with an alt tag that has your keyword….wait there’s even more Now what if i told you there was a simple WordPress plugin that does all the On-Page SEO, and automatically for you? That’s right AUTOMATICALLY, just watch this 4minute video for more information at. Seo Plugin

  59. Ok really, usually I don’t comment on your posts but I really need to ask something. I noticed that when I try to post a comment the page after I click the button is blank. Is that because of some spamfilter? If so what is it? Also where can I download it, I would like to try it on my own blog! Would be much appreciated. Regards, Jenni

  60. Appreciate all the hardwork!very well posted!

  61. vom Anfange bis zum Ende des Mahlprocesses ein,

  62. Hi, you have a great website. If you want to Get Unlimited Supply Of High PR Backlinks And Laser Targeted Traffic From Major Bookmarking Sites… All Done In Minutes On Autopilot! Check out

  63. Yahoo Answers are loved by Google and many of the Yahoo Answers are sitting on high ranking especially for some highly competitive keywords. You can’t even imagine what effect can Yahoo Answers provide to the traffic of your site. Don’t wait and learn more about this at

  64. I just want to mention I’m new to blogging and really loved your web blog. Most likely I’m planning to bookmark your blog post . You amazingly have exceptional article content. Thanks a bunch for sharing with us your blog.

  65. Freddie Gist says:

    I just want to say I am just new to blogs and truly loved you’re blog. Almost certainly I’m planning to bookmark your blog post . You actually come with beneficial writings. Many thanks for sharing your webpage.

  66. I just want to mention I am just newbie to blogging and truly savored this web page. Likely I’m want to bookmark your blog post . You definitely come with good articles. Cheers for revealing your web site.

  67. I simply want to mention I am all new to blogging and site-building and honestly liked you’re blog. Most likely I’m likely to bookmark your blog . You amazingly have really good well written articles. With thanks for revealing your web page.

Trả lời

Please log in using one of these methods to post your comment: Logo

Bạn đang bình luận bằng tài khoản Đăng xuất /  Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Đăng xuất /  Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Đăng xuất /  Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Đăng xuất /  Thay đổi )


Connecting to %s

%d bloggers like this: