{"id":3633,"date":"2018-01-22T23:43:07","date_gmt":"2018-01-22T15:43:07","guid":{"rendered":"http:\/\/www.bookcard.net\/wordpress\/?p=3633"},"modified":"2018-10-14T21:24:03","modified_gmt":"2018-10-14T13:24:03","slug":"opengl_material","status":"publish","type":"post","link":"https:\/\/www.bookcard.net\/wordpress\/opengl_material\/","title":{"rendered":"OpenGL\u4e4b\u6750\u8cea"},"content":{"rendered":"<figure id=\"attachment_3634\" aria-describedby=\"caption-attachment-3634\" style=\"width: 1024px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_Material.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3634\" src=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_Material.jpg\" alt=\"\" width=\"1024\" height=\"768\" srcset=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_Material.jpg 1024w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_Material-300x225.jpg 300w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_Material-768x576.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption id=\"caption-attachment-3634\" class=\"wp-caption-text\">OpenGL\u4e4b\u6750\u8cea<\/figcaption><\/figure>\n<p>OpengGL\u70ba\u591a\u908a\u5f62\u8a2d\u7f6e\u6750\u8cea\u5c6c\u6027,\u6839\u64da\u7d05\u7da0\u85cdRGB\u7684\u5206\u91cf\u800c\u78ba\u5b9a\u53cd\u5c04\u5149\u984f\u8272:\u5982\u4e0b\u8868:<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"151\">\u6750\u8cea<\/td>\n<td width=\"145\">\u5149\u6e90\u7684\u5149\u984f<\/td>\n<td width=\"142\">\u53cd\u5c04\u5149\u984f\u8272,<\/td>\n<td width=\"130\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"151\">\u7da0\u8272(0,1,0)<\/td>\n<td width=\"145\">\u767d\u8272(1,1,1)<\/td>\n<td width=\"142\">\u7da0\u8272(0,1,0)<\/td>\n<td width=\"130\">\u53ea\u53cd\u5c04\u7da0\u5149<\/td>\n<\/tr>\n<tr>\n<td width=\"151\">\u7da0\u8272(0,1,0)<\/td>\n<td width=\"145\">\u7d05\u8272(1,0,0)<\/td>\n<td width=\"142\">\u9ed1\u8272(0,0,0)<\/td>\n<td width=\"130\">\u53ea\u53cd\u5c04\u9ed1\u5149<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"284\">\u6750\u8cea<\/td>\n<td width=\"284\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">void glMaterialf(GLenum face, GLenum pname, GLfloat param);<\/td>\n<td width=\"284\">\u70ba\u591a\u908a\u5f62\u8a2d\u7f6e\u6750\u8cea\u5c6c\u6027\u7528\u65bc\u5149\u7167\u8a08\u7b97,\u5b83\u662f\u5168\u5c40\u6027\u7684, \u5f71\u97ff\u6240\u6709\u7e6a\u88fd\u7684\u591a\u908a\u5f62,\u76f4\u5230\u5728\u6b21\u8abf\u7528<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params);<\/td>\n<td width=\"284\">glMaterialf()\u6578\u7d44\u7248\u672c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"284\">face<\/td>\n<td width=\"284\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_FRONT<\/td>\n<td width=\"284\">\u6750\u8cea\u50c5\u61c9\u7528\u65bc\u591a\u908a\u5f62\u6b63\u9762<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_BACK<\/td>\n<td width=\"284\">\u591a\u908a\u5f62\u53cd\u9762<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_FRONT_AND_BACK<\/td>\n<td width=\"284\">\u591a\u908a\u5f62\u7684\u6b63\u53cd\u9762<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"211\">pname<\/td>\n<td width=\"72\">\u6578\u503c<\/td>\n<td width=\"285\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"211\">GL_AMBIENT<\/td>\n<td width=\"72\">{r,g,b,a}<\/td>\n<td width=\"285\">\u6750\u8cea\u7684\u74b0\u5883\u5149\u984f\u8272<\/td>\n<\/tr>\n<tr>\n<td width=\"211\">GL_DIFFUSE<\/td>\n<td width=\"72\">{r,g,b,a}<\/td>\n<td width=\"285\">\u6750\u8cea\u7684\u6563\u5c04\u5149\u984f\u8272<\/td>\n<\/tr>\n<tr>\n<td width=\"211\">GL_AMBIENT_AND_DIFFUSE<\/td>\n<td width=\"72\">{r,g,b,a}<\/td>\n<td width=\"285\">\u540c\u6642\u8a2d\u7f6e\u6750\u8cea\u7684\u74b0\u5883\u5149\u548c\u6563\u5c04\u5149\u984f\u8272<\/td>\n<\/tr>\n<tr>\n<td width=\"211\">GL_SPECULAR<\/td>\n<td width=\"72\">{r,g,b,a}<\/td>\n<td width=\"285\">\u6750\u8cea\u7684\u93e1\u9762\u53cd\u5c04\u5149\u984f\u8272,\u53cd\u5c04\u51fa\u53bb\u7684\u984f\u8272\u4e0d\u5927\u65bc\u6750\u8cea\u984f\u8272<\/p>\n<p>{1.0f,1.0f,1.0f,1.0f}:\u5149\u6703\u5b8c\u5168\u53cd\u5c04\u51fa\u53bb<\/td>\n<\/tr>\n<tr>\n<td width=\"211\">GL_SHININESS<\/td>\n<td width=\"72\">0-128<\/td>\n<td width=\"285\">\u93e1\u9762\u53cd\u5c04\u5149\u6307\u6578<\/p>\n<p>0:\u4e0d\u805a\u7126<\/p>\n<p>128:\u9ad8\u5ea6\u805a\u7126<\/td>\n<\/tr>\n<tr>\n<td width=\"211\">GL_EMISSION<\/td>\n<td width=\"72\">{r,g,b,a}<\/td>\n<td width=\"285\">\u6750\u8cea\u7684\u53cd\u5c04\u5149\u984f\u8272<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8a2d\u7f6e\u591a\u908a\u5f62\u6750\u8cea\u7684\u74b0\u5883\u5149\u548c\u6563\u5c04\u5149,\u51fd\u5f0f\u793a\u4f8b:<\/p>\n<ol>\n<li>glEnable(GL_LIGHTING); \/\/ \u555f\u7528\u5149\u7167<\/li>\n<li>float white[] = {0f,1.0f,1.0f,1.0f};\/\/ \u767d\u8272<\/li>\n<li>glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, white);\/\/ \u8a2d\u7f6e\u6750\u8cea<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>OpengGL\u70ba\u591a\u908a\u5f62\u8a2d\u7f6e\u6750\u8cea\u5c6c\u6027,\u6839\u64da\u7d05\u7da0\u85cdRGB\u7684\u5206\u91cf\u800c\u78ba\u5b9a\u53cd\u5c04\u5149\u984f\u8272:\u5982\u4e0b\u8868: \u6750\u8cea \u5149\u6e90\u7684\u5149\u984f \u53cd\u5c04\u5149 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/opengl_material\/\" class=\"more-link\">\u7e7c\u7e8c\u95b1\u8b80 <span class=\"screen-reader-text\">OpenGL\u4e4b\u6750\u8cea<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[62],"tags":[50],"class_list":["post-3633","post","type-post","status-publish","format-standard","hentry","category-opengl","tag-opengl","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/3633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/comments?post=3633"}],"version-history":[{"count":4,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/3633\/revisions"}],"predecessor-version":[{"id":3644,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/3633\/revisions\/3644"}],"wp:attachment":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/media?parent=3633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/categories?post=3633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/tags?post=3633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}