{"id":3654,"date":"2018-01-29T11:25:29","date_gmt":"2018-01-29T03:25:29","guid":{"rendered":"http:\/\/www.bookcard.net\/wordpress\/?p=3654"},"modified":"2018-10-14T21:24:56","modified_gmt":"2018-10-14T13:24:56","slug":"opengl_blend","status":"publish","type":"post","link":"https:\/\/www.bookcard.net\/wordpress\/opengl_blend\/","title":{"rendered":"OpenGL\u4e4b\u984f\u8272\u6df7\u5408"},"content":{"rendered":"<figure id=\"attachment_3656\" aria-describedby=\"caption-attachment-3656\" style=\"width: 1024px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_Blend.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3656\" src=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_Blend.jpg\" alt=\"\" width=\"1024\" height=\"768\" srcset=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_Blend.jpg 1024w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_Blend-300x225.jpg 300w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGL_Blend-768x576.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption id=\"caption-attachment-3656\" class=\"wp-caption-text\">OpenGL\u4e4b\u984f\u8272\u6df7\u5408<\/figcaption><\/figure>\n<p>\u5728<a href=\"https:\/\/www.bookcard.net\/wordpress\/opengl_alpha\/\">OpenGL\u4e4b\u984f\u8272\u6df7\u5408alpha<\/a>\u901a\u904eglBlendFunc()\u8a2d\u5b9a\u7684\u6df7\u5408\u56e0\u5b50\u751f\u6210\u900f\u660e\u6548\u679c,\u4f46\u901a\u904e\u5176\u5b83\u7684\u6df7\u5408\u56e0\u5b50\u53ef\u7522\u751f\u66f4\u591a\u4e0d\u540c\u7684\u6df7\u5408\u6548\u679c.\u4ee4\u5916OpenGL\u7684\u984f\u8272\u6df7\u5408\u662f\u7121\u9700\u555f\u7528\u5149\u7167\u7684glEnable(GL_LIGHTING); \u4f46\u9700\u8981\u555f\u52d5\u591a\u908a\u5f62\u96b1\u9762\u88c1\u526a::glEnable(GL_CULL_FACE);\u5426\u5247\u6703\u6709\u4e00\u9762\u6703\u7e6a\u756b\u932f\u8aa4.<\/p>\n<p>\u6df7\u5408\u56e0\u5b50\u6f14\u793a\u7a0b\u5f0f.<a href=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/01\/OpenGLBlend.zip\">\u4e0b\u8f09<\/a><\/p>\n<ol>\n<li>\u8a2d\u5b9aSour Factor\u9078\u64c7\u201d\u4f86\u6e90\u6df7\u5408\u56e0\u5b50\u201d<\/li>\n<li>\u8a2d\u5b9aDest Factor\u9078\u64c7\u201d\u76ee\u6a19\u6df7\u5408\u56e0\u5b50\u201d<\/li>\n<li>\u8a2d\u5b9aBlend Equation\u9078\u64c7\u201d\u6df7\u5408\u516c\u5f0f\u201d<\/li>\n<\/ol>\n<table>\n<tbody>\n<tr>\n<td width=\"284\">glBlendFunc()\u7684\u6df7\u5408\u516c\u5f0f<\/td>\n<td width=\"284\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_FUNC_ADD<\/td>\n<td width=\"284\">C =(Cs*S)+(Cd*D) \u9ed8\u8a8d\u503c<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_MIN<\/td>\n<td width=\"284\">C =MIN(Cs,Cd)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_MAX<\/td>\n<td width=\"284\">C =MAX(Cs,Cd)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_FUNC_SUBTRACT<\/td>\n<td width=\"284\">C =(Cs*S)-(Cd*D)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_FUNC_REVERSE_SUBTRACT<\/td>\n<td width=\"284\">C =(Cd*S)-(Cs*D)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"284\">\u516c\u5f0f\u56e0\u5b50<\/td>\n<td width=\"284\">\u7c21\u4ecb:\u6df7\u5408\u56e0\u5b50\u7684\u7c21\u4ecb\u53ef\u901a\u904e\u6700\u4e0b\u8868\u67e5\u95b1<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">Cs:<\/td>\n<td width=\"284\">\u4f86\u6e90\u984f\u8272<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">S:<\/td>\n<td width=\"284\">\u4f86\u6e90\u6df7\u5408\u56e0\u5b50<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">Cd:<\/td>\n<td width=\"284\">\u76ee\u6a19\u984f\u8272<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">D:<\/td>\n<td width=\"284\">\u76ee\u6a19\u6df7\u5408\u56e0\u5b50<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"284\">S\u4f86\u6e90\u6df7\u5408\u56e0\u5b50<\/td>\n<td width=\"284\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ZERO<\/td>\n<td width=\"284\">sour (r,g,b,a) *{0,0,0,0}<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE<\/td>\n<td width=\"284\">sour (r,g,b,a) * (1,1,1,1)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_DST_COLOR<\/td>\n<td width=\"284\">sour (r,g,b,a) * dest (r,g,b,a)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_DST_COLOR<\/td>\n<td width=\"284\">sour (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\">sour (r,g,b,a) * sour(alpha)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_SRC_ALPHA<\/td>\n<td width=\"284\">sour (r,g,b,a) * (1- sour(alpha))<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_DST_ALPHA<\/td>\n<td width=\"284\">sour (r,g,b,a) * dest(alpha)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_DST_ALPHA<\/td>\n<td width=\"284\">sour (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\">sour (r,g,b,a) * MIN(sour(alpha),1-dest(alpha))<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_CONSTANT_COLOR<\/td>\n<td width=\"284\">sour (r,g,b,a)* Color(r,g,b,a)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_CONSTANT_COLOR<\/td>\n<td width=\"284\">sour (r,g,b,a)*( (1,1,1,1)- Color(r,g,b,a))<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_CONSTANT_ALPHA<\/td>\n<td width=\"284\">sour (r,g,b,a)* Color(alpha)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_CONSTANT_ALPHA<\/td>\n<td width=\"284\">sour (r,g,b,a)*(1-Color(alpha))<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"284\">D\u76ee\u6a19\u6df7\u5408\u56e0\u5b50<\/td>\n<td width=\"284\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ZERO<\/td>\n<td width=\"284\">dest (r,g,b,a) *{0,0,0,0}<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE<\/td>\n<td width=\"284\">dest (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\">dest (r,g,b,a) * sour (r,g,b,a)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_SRC_COLOR<\/td>\n<td width=\"284\">dest (r,g,b,a) * ((1,1,1,1)- sour (r,g,b,a))<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_SRC_ALPHA<\/td>\n<td width=\"284\">dest (r,g,b,a) * sour (alpha)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_SRC_ALPHA<\/td>\n<td width=\"284\">dest (r,g,b,a) * (1- sour (alpha))<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_DST_ALPHA<\/td>\n<td width=\"284\">dest (r,g,b,a) * dest (alpha)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_DST_ALPHA<\/td>\n<td width=\"284\">dest (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\">dest (r,g,b,a) * MIN(sour(alpha),1-dest(alpha))<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_CONSTANT_COLOR<\/td>\n<td width=\"284\">dest (r,g,b,a)* Color(r,g,b,a)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_CONSTANT_COLOR<\/td>\n<td width=\"284\">dest (r,g,b,a)*( (1,1,1,1)- Color(r,g,b,a))<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_CONSTANT_ALPHA<\/td>\n<td width=\"284\">dest (r,g,b,a)* Color(alpha)<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">GL_ONE_MINUS_CONSTANT_ALPHA<\/td>\n<td width=\"284\">dest (r,g,b,a)*(1-Color(alpha))<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0a\u8868\u7684Color\u6df7\u5408\u5e38\u91cf\u901a\u904eglBlendColor()\u8a2d\u5b9a<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"284\">\u8a2d\u5b9a\u6df7\u5408\u5e38\u91cf<\/td>\n<td width=\"284\">\u7c21\u4ecb<\/td>\n<\/tr>\n<tr>\n<td width=\"284\">Void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha;<\/td>\n<td width=\"284\">\u6df7\u5408\u5e38\u91cf\u9ed8\u8a8d\u70ba(0,0,0,0)\u4f5c\u70ba\u6df7\u5408\u6b0a\u91cd\u4fc2\u6578<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728OpenGL\u4e4b\u984f\u8272\u6df7\u5408alpha\u901a\u904eglBlendFunc()\u8a2d\u5b9a\u7684\u6df7\u5408\u56e0\u5b50\u751f\u6210\u900f\u660e\u6548\u679c,\u4f46\u901a\u904e\u5176\u5b83\u7684\u6df7\u5408\u56e0 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/opengl_blend\/\" class=\"more-link\">\u7e7c\u7e8c\u95b1\u8b80 <span class=\"screen-reader-text\">OpenGL\u4e4b\u984f\u8272\u6df7\u5408<\/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-3654","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\/3654","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=3654"}],"version-history":[{"count":3,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/3654\/revisions"}],"predecessor-version":[{"id":3659,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/3654\/revisions\/3659"}],"wp:attachment":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/media?parent=3654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/categories?post=3654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/tags?post=3654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}