{"id":3645,"date":"2018-01-26T20:27:59","date_gmt":"2018-01-26T12:27:59","guid":{"rendered":"http:\/\/www.bookcard.net\/wordpress\/?p=3645"},"modified":"2018-10-14T21:23:45","modified_gmt":"2018-10-14T13:23:45","slug":"opengl_alpha","status":"publish","type":"post","link":"https:\/\/www.bookcard.net\/wordpress\/opengl_alpha\/","title":{"rendered":"OpenGL\u4e4b\u984f\u8272\u6df7\u5408alpha"},"content":{"rendered":"<figure id=\"attachment_3646\" aria-describedby=\"caption-attachment-3646\" style=\"width: 1024px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_alpha.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3646\" src=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_alpha.jpg\" alt=\"\" width=\"1024\" height=\"768\" srcset=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_alpha.jpg 1024w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_alpha-300x225.jpg 300w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_alpha-768x576.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption id=\"caption-attachment-3646\" class=\"wp-caption-text\">OpenGL\u4e4b\u984f\u8272\u6df7\u5408alpha<\/figcaption><\/figure>\n<p>\u984f\u8272\u6df7\u5408(alpha)\u53ef\u5be6\u73fe\u900f\u660e\u7684\u8996\u89d2\u6548\u679c,\u53ef\u4ee5\u6a21\u64ec\u6db2\u9ad4\u3001\u73bb\u7483\u7b49.\u7576\u4f60\u555f\u52d5\u6df7\u5408OpenGL\u5c07\u8f38\u5165\u6e90\u7684\u984f\u8272\u8207\u548c\u5728\u5e40\u7de9\u5b58\u88cf\u7684\u984f\u8272\u6df7\u5408<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"284\">\u51fd\u5f0f<\/td>\n<td width=\"284\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">glEnable(GL_BLEND);<\/td>\n<td width=\"284\">\u555f\u7528\u6df7\u5408<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">glDisable(GL_BLEND);<\/td>\n<td width=\"284\">\u7981\u7528\u6df7\u5408<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td width=\"284\">\u51fd\u5f0f<\/td>\n<td width=\"284\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">Void glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);<\/td>\n<td width=\"284\">\u8a2d\u5b9a\u984f\u8272\u548c\u900f\u660e\u5ea6<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">red, green, blue<\/td>\n<td width=\"284\">\u984f\u8272<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">alpha<\/td>\n<td width=\"284\">\u900f\u660e\u5ea6\u6578\u503c\u7bc4\u570d:0.0f-1.0f<\/p>\n<p>0:\u5168\u900f\u660e<\/p>\n<p>1:\u5b8c\u5168\u4e0d\u900f\u660e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u51fd\u5f0f\u793a\u4f8b<\/p>\n<ol>\n<li>glEnable(GL_BLEND);\/\/ \u555f\u7528\u6df7\u5408<\/li>\n<li>glDepthMask(GL_FALSE);\/\/ \u5c07\u6df1\u5ea6\u74b0\u5b58\u8a2d\u7f6e\u70ba\u53ea\u8b80<\/li>\n<li>glBlendFunc(GL_SRC_ALPHA,GL_ONE); \/\/ \u900f\u660e\u6548\u679c<\/li>\n<li>glColor4f(1.0f, 1.0f, 1.0f,alpha);\/\/\u6708\u7403\u6a21\u578b\u984f\u8272<\/li>\n<li>auxSolidSphere(1.0f);\/\/ \u7e6a\u756b<\/li>\n<li>glDepthMask(GL_TRUE);\/\/ \u5c07\u6df1\u5ea6\u74b0\u5b58\u8a2d\u7f6e\u70ba\u53ef\u8b80\u53ef\u5beb<\/li>\n<li>glDisable(GL_BLEND);\/\/ \u7981\u7528\u6df7\u5408<\/li>\n<\/ol>\n<table>\n<tbody>\n<tr>\n<td width=\"311\">\u6df7\u5408\u51fd\u5f0f<\/td>\n<td width=\"257\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"311\">void glBlendFunc (GLenum sfactor, GLenum dfactor);<\/td>\n<td width=\"257\">\u8a2d\u5b9a\u4f86\u6e90\u548c\u76ee\u6a19\u6df7\u5408\u4fc2\u6578<\/td>\n<\/tr>\n<tr>\n<td width=\"311\">sfactor<\/td>\n<td width=\"257\">\u8f38\u5165\u6e90\u6578\u64da\u7684\u6df7\u5408\u4fc2\u6578<\/td>\n<\/tr>\n<tr>\n<td width=\"311\">dfactor<\/td>\n<td width=\"257\">\u7576\u524d\u5e40\u7de9\u5b58\u7684\u6df7\u5408\u4fc2\u6578<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"284\">\u6df7\u5408\u4fc2\u6578<\/td>\n<td width=\"284\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ZERO<\/td>\n<td width=\"284\">\u5c07\u984f\u8272\u8a2d\u70ba{0,0,0,0}<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE<\/td>\n<td width=\"284\">\u4e0d\u6539\u8b8a\u7576\u524d\u984f\u8272(r,g,b,a)*(1,1,1,1)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_SRC_COLOR<\/td>\n<td width=\"284\">\u76ee\u6a19\u8207\u4f86\u6e90\u76f8\u4e58dest (r,g,b,a)* sour (r,g,b,a)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_DST_COLOR<\/td>\n<td width=\"284\">\u4f86\u6e90\u8207\u76ee\u6a19\u76f8\u4e58sour (r,g,b,a)* dest (r,g,b,a)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_SRC_COLOR<\/td>\n<td width=\"284\">(r,g,b,a)*((1,1,1,1)- sour(r,g,b,a))<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_DST_COLOR<\/td>\n<td width=\"284\">(r,g,b,a)*((1,1,1,1)- dest(r,g,b,a))<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_SRC_ALPHA<\/td>\n<td width=\"284\">(r,g,b,a) * sour(alpha)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_DST_ALPHA<\/td>\n<td width=\"284\">(r,g,b,a) * dest(alpha)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_SRC_ALPHA<\/td>\n<td width=\"284\">(r,g,b,a) * (1- sour(alpha))<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_DST_ALPHA<\/td>\n<td width=\"284\">(r,g,b,a) * (1- dest(alpha))<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_SRC_ALPHA_SATURATE<\/td>\n<td width=\"284\">(r,g,b,a) *MIN (sour(alpha),1-dest(alpha))<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"284\">\u51fd\u5f0f<\/td>\n<td width=\"284\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">glEnable(GL_DEPTH_TEST);<\/td>\n<td width=\"284\">\u6253\u958b\u6df1\u5ea6\u6aa2\u6e2c(Z\u8ef8\u7de9\u5b58), \u4e00\u5b9a\u8981\u8abf\u7528.\u4fdd\u8b49\u5149\u7167\u6b63\u78ba\u7e6a\u88fd\u548c\u6a21\u5f62\u524d\u5f8c\u6b63\u78ba\u7e6a\u88fd<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Alpha\u6f14\u793a\u7a0b\u5f0f\u793a\u4f8b,\u5206\u5225\u6709\u592a\u967d,\u5730\u7403\u548c\u6708\u7403.<a href=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGLAlpha.zip\">\u4e0b\u8f09\u7a0b\u5f0f<\/a><\/p>\n<ol>\n<li>\u6309+\/-\u9375\u589e\u52a0\u6216\u6e1b\u5c0f\u6708\u7403\u900f\u660e\u5ea6<\/li>\n<li>\u6309SPACE(\u7a7a\u683c)\u9375\u555f\u7528\u6216\u7981\u7528\u805a\u5149\u71c8<\/li>\n<li>\u6309UP\/DOWN\u9375\u76f8\u6a5f\u524d\u5f8c\u79fb\u52d5<\/li>\n<li>\u6309LEFT\/RIGHT\u9375\u76f8\u6a5f\u5de6\u53f3\u65cb\u8f49<\/li>\n<li>\u6309F1\u9375\u6253\u958b\u5e6b\u52a9<\/li>\n<li>\u6309ESC\u9375\u91cd\u7f6e\u805a\u5149\u71c8\u53c3\u6578<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u984f\u8272\u6df7\u5408(alpha)\u53ef\u5be6\u73fe\u900f\u660e\u7684\u8996\u89d2\u6548\u679c,\u53ef\u4ee5\u6a21\u64ec\u6db2\u9ad4\u3001\u73bb\u7483\u7b49.\u7576\u4f60\u555f\u52d5\u6df7\u5408OpenGL\u5c07\u8f38\u5165\u6e90\u7684\u984f\u8272\u8207\u548c\u5728 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/opengl_alpha\/\" class=\"more-link\">\u7e7c\u7e8c\u95b1\u8b80 <span class=\"screen-reader-text\">OpenGL\u4e4b\u984f\u8272\u6df7\u5408alpha<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[62],"tags":[50],"class_list":["post-3645","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\/3645","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=3645"}],"version-history":[{"count":5,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/3645\/revisions"}],"predecessor-version":[{"id":3653,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/3645\/revisions\/3653"}],"wp:attachment":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/media?parent=3645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/categories?post=3645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/tags?post=3645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}