android磨皮
1. Android OpenGLES 瀹炴椂緹庨(紓ㄧ毊)鐨勪紭鍖(浜)
鍦ㄥ墠涓綃囨枃絝 Android OpenGLES 瀹炴椂緹庨(紓ㄧ毊)鐨勪紭鍖 錛屾垜浠宸茬粡浠嬬粛浜嗗叧浜庡疄鏃剁編棰(紓ㄧ毊)鐨勪竴浜涗紭鍖栫偣銆備絾鍦ㄥ疄闄呯殑浼樺寲嫻嬭瘯涓鍙戠幇錛屽綋澶勭悊鍣ㄥ彂鐑涔嬪悗錛屽氨鏃犳硶淇濊瘉棰勮堝撫鐜囦簡錛屼富瑕佽繕鏄楂樻柉妯$硦澶勭悊鐨勬暟鎹閲忔瘮杈冨ぇ瀵艱嚧銆傚洜姝わ紝鎴戜滑闇瑕佸繪壘鏂扮殑紓ㄧ毊鏂規硶銆
鐩鍓嶅競闈涓婂叧浜庣(鐨鏂規硶鏈夊ソ澶氱嶏紝浣跨敤PS紓ㄧ毊緇忓父鐢ㄥ埌鐨勬柟娉曞寘鎷楂樺弽宸淇濈暀銆侀珮浣庨戙佷腑鎬х伆浠ュ強鍙岀嚎鎬х瓑銆傚叾涓涓鎬х伆鍜屽弻綰挎х殑鏁堢巼涓鑸錛屽洜姝わ紝鎴戜滑浠庨珮鍙嶅樊淇濈暀銆侀珮浣庨戣繖涓ょ嶆柟娉曚腑閫夋嫨銆傝繖閲岄夋嫨浣跨敤楂樺弽宸淇濈暀娉曞仛紓ㄧ毊澶勭悊錛孭S涓鐨勯珮鍙嶅樊淇濈暀娉曡繘琛岀(鐨錛岄殢鎵嬩竴鎼滀究鑳芥壘鍒板緢澶氭枃絝狅紝姣斿傦細
https://jingyan..com/article/455a99504d568fa1662778d6.html
鎺ヤ笅鏉ワ紝鎴戜滑灝濊瘯鐫瀹炵幇鏂囩珷涓璁插埌鐨勮繃紼嬨
鍏充簬楂樻柉妯$硦鐨勪紭鍖栵紝鍙浠ュ弬鑰冩湰浜虹殑鏂囩珷錛
OpenGLES婊ら暅寮鍙戞眹鎬 鈥斺 楂樻柉妯$硦瀹炵幇浠ュ強浼樺寲
瀵逛簬浜哄儚榪涜岄珮鏂妯$硦錛屾垜浠璁捐′竴涓11x11鐨勯珮鏂綆楀瓙瀵瑰浘鍍忚繘琛岄珮鏂妯$硦錛宻hader濡備笅錛
vertex shader :
fragment shader:
緇忚繃浠ヤ笂鐨剆hader榪涜岄珮鏂妯$硦澶勭悊涔嬪悗錛屾垜浠寰楀埌榪欐牱涓寮犻珮鏂妯$硦鍥懼儚錛
鍦≒S鐨勯珮鍙嶅樊淇濈暀紓ㄧ毊鏂規硶涓錛岄珮鍙嶅樊淇濈暀紓ㄧ毊娣峰悎閲囩敤鐨勬槸寮哄厜妯″紡錛岃$畻鍏寮忎負錛歝olor = 2 * color1 * color2銆傚洜姝わ紝鎴戜滑璁捐″嚭榪欐牱涓涓楂橀氭護娉㈠櫒錛屽叾shader濡備笅錛
fragment shader:
緇忚繃楂橀氭護娉㈠櫒涔嬪悗錛屾垜浠寰楀埌榪欐牱涓涓綰圭悊鍥懼儚錛
鍙浠ョ湅鍒幫紝緇忚繃涓夐氶亾寮哄厜娣峰悎澶勭悊鍚庯紝鐥樺嵃銆佽竟娌跨瓑鍦版柟閮芥竻鏅拌搗鏉ヤ簡銆傚己鍏夌殑紼嬪害錛屼竴鑸鏄3鐨勫嶆暟錛岃繖閲屽彇24鍊嶃
鍒拌繖涓姝ワ紝鍏跺疄鎴戜滑宸茬粡寰楀埌浜嗛渶瑕佽繃婊ら滆壊鍊礆紝浣嗗湪榪欎竴寮犲浘涓錛屼篃鎶婅竟娌跨殑棰滆壊宸鍊煎寘鍚榪涙潵浜嗐傛垜浠鎺ヤ笅鏉ラ渶瑕佽繃婊ゆ帀杈規部鐨勯滆壊宸鍊箋傝繖鏍峰湪鍚庣畫鐨勫勭悊涓錛屾垜浠鍙浠ヤ繚鐣欒竟娌跨殑緇嗚妭涓嶈妯$硦鎺夈傚洜姝ゆ帴涓嬫潵錛屾垜浠闇瑕佸皢緇忚繃楂橀氭護娉㈠緱鍒扮殑綰圭悊錛屽啀鍋氫竴嬈¢珮鏂妯$硦銆備笉榪囪繖涓嬈′笉鑳11 x11 榪欎箞澶х殑楂樻柉綆楀瓙錛屾垜浠閫夋嫨涓涓 5 x 5 澶у皬鐨勯珮鏂綆楀瓙銆傞珮鏂妯$硦鐨剆hader 濡備笅錛
vertex shader:
fragment shader:
灝嗛珮閫氭護娉㈠櫒寰楀埌鐨勭汗鐞嗭紝緇忚繃楂樻柉妯$硦澶勭悊鍚庯紝寰楀埌榪欐牱涓寮犵汗鐞嗭細
瀵規瘮楂橀氭護娉㈠櫒澶勭悊鍚庣殑綰圭悊錛岃竟娌跨粏鑺傚彉寰楁ā緋婁簡錛岃屼笖錛岄渶瑕佽繃婊ょ殑棰滆壊宸鍊間粛鏃т繚鐣欑潃銆傚埌榪欎竴姝ワ紝鎴戜滑灝卞緱鍒頒簡鍋氱(鐨澶勭悊鐨勫墠緗綰圭悊銆傛帴涓嬫潵灝辨槸楂樺弽宸淇濈暀紓ㄧ毊鐨勬渶鍚庝篃鏄鏈閲嶈佺殑涓姝ャ
緇忚繃鍓嶉潰鐨勫勭悊錛屾垜浠寰楀埌涓寮犺緭鍏ュ浘鐗囩殑楂樻柉妯$硦綰圭悊錛屼互鍙婁竴寮犻珮鍙嶅樊淇濈暀鐨勯珮鏂妯$硦綰圭悊銆傛垜浠浣跨敤榪欎袱寮犵汗鐞嗭紝閫氳繃姣旇緝钃濊壊閫氶亾錛岃$畻鍑洪渶瑕佺(鐨鐨勫疄闄呭己搴﹀礆紝涓庡師鍥捐繘琛屾販鍚堝勭悊錛岀劧鍚庤緭鍑烘渶緇堢殑綰圭悊銆俿hader濡備笅鎵紺猴細
緇忚繃涓婇潰鐨勫勭悊涔嬪悗錛屾垜浠灝卞緱鍒扮(鐨澶勭悊鐨勭粨鏋滃備笅錛
鍙浠ョ湅鍒幫紝緇忚繃楂樺弽宸淇濈暀紓ㄧ毊鍚庣殑緇撴灉錛岀(鐨鏁堟灉榪樹笉閿欙紝鑰屼笖720P紓ㄧ毊澶勭悊鏃訛紝鍦ㄩ珮閫氶獊榫625澶勭悊鍣ㄤ笂錛岀粡榪囬珮鍙嶅樊淇濈暀紓ㄧ毊涔嬪悗錛岄勮堝撫鐜囪兘澶熶繚鎸佸湪30FPS宸﹀彸銆傛垜浠鍙浠ョ湅鍒幫紝杈規部緇嗚妭榪樻槸涓嶅熸槑鏄撅紝鎵浠ワ紝鎴戜滑鍙浠ヤ嬌鐢║SM閿愬寲澧炲己杈規部緇嗚妭閮ㄥ垎銆傝繖綃囨枃絝犲氨涓嶈茶ВUSM閿愬寲鐨勫疄鐜頒簡銆
璇︾粏瀹炵幇榪囩▼錛屽彲浠ュ弬鑰冩湰浜虹殑寮婧愮浉鏈洪」鐩錛
CainCamera
CainCamera鐨凢ilterLibrary涓鏈夌粡榪囦紭鍖栧悗鐨勫疄鏃剁編棰(紓ㄧ毊)瀹炵幇銆