{"id":181794,"date":"2013-06-02T17:25:05","date_gmt":"2013-06-02T13:25:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=181794"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=181794","title":{"rendered":"<span class=\"post_title\">\u0417\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 \u0448\u0435\u0439\u0434\u0435\u0440\u0430\u043c\u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 GPUImage<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/467\/333\/586\/467333586cfe4711a12a20a6c6d014c6.png\"\/><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f iphone, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0441 \u043a\u0430\u043c\u0435\u0440\u044b \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c GPUImage \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 \u043d\u0430 OpenGL ES \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. <br \/>  <a name=\"habracut\"><\/a><\/p>\n<h4>GPUImage \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a<\/h4>\n<p>  GPUImage \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f iOS, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0411\u0440\u044d\u0434\u043e\u043c \u041b\u0430\u0440\u0441\u043e\u043d\u043e\u043c \u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c\u0430\u044f \u043f\u043e\u0434 BSD \u2013 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 GPU \u043a \u0444\u0438\u043b\u044c\u043c\u0430\u043c, \u0436\u0438\u0432\u043e\u0439 \u0432\u0438\u0434\u0435\u043e\u0441\u044a\u0435\u043c\u043a\u0435 \u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c.<\/p>\n<h4>GPU vs CPU<\/h4>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 iphone \u043e\u0441\u043d\u0430\u0449\u0435\u043d \u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438: CPU \u0438 GPU, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u0441\u0438\u043b\u044c\u043d\u044b\u0435 \u0438 \u0441\u043b\u0430\u0431\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b.<br \/>  \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u043f\u0438\u0448\u0438\u0442\u0435 \u043d\u0430 C \u0438\u043b\u0438 Objective-C \u0432 Xcode, \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 CPU. GPU \u0436\u0435 \u043d\u0430\u043f\u0440\u043e\u0442\u0438\u0432, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0447\u0438\u043f, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u0435\u043b\u043a\u0438\u0445, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0442\u0430\u043a\u0438\u0445, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043a\u0430\u043a \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0433\u0440\u0430\u0444\u0438\u043a\u0438. \u0422\u0438\u043f\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 CPU, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u043d\u0430 OpenGL (\u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e \u043d\u0430 \u0448\u0435\u0439\u0434\u0435\u0440\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435 GLSL).<br \/>  \u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0432\u0438\u0434\u0435\u043e \u043d\u0430 CPU \u0438 GPU, \u0437\u0430\u043c\u0435\u0442\u043d\u043e, \u0447\u0442\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0433\u0440\u043e\u043c\u043d\u044b:<\/p>\n<p>  \u0427\u0430\u0441\u0442\u043e\u0442\u0430 \u043a\u0430\u0434\u0440\u043e\u0432: CPU vs. GPU (\u0411\u043e\u043b\u044c\u0448\u0438\u0439 FPS \u043b\u0443\u0447\u0448\u0435) <\/p>\n<table>\n<tr>\n<th>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f<\/th>\n<th>GPU FPS<\/th>\n<th>CPU FPS<\/th>\n<th>\u0394<\/th>\n<\/tr>\n<tr>\n<td>\u041f\u043e\u0440\u043e\u0433\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2613 1<\/td>\n<td>60.00<\/td>\n<td>4.21<\/td>\n<td>14.3<\/td>\n<\/tr>\n<tr>\n<td>\u041f\u043e\u0440\u043e\u0433\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2613 2<\/td>\n<td>33.63<\/td>\n<td>2.36<\/td>\n<td>14.3<\/td>\n<\/tr>\n<tr>\n<td>\u041f\u043e\u0440\u043e\u0433\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2613 100<\/td>\n<td>1.45<\/td>\n<td>0.05<\/td>\n<td>28.7<\/td>\n<\/tr>\n<\/table>\n<h4>GPUImage vs Core Image<\/h4>\n<p>  Core Image \u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u0432\u0438\u0434\u0435\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 ios 5, \u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438\u043c\u0435\u043b \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0443\u0436 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 (\u0445\u043e\u0442\u044f \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0437\u0430\u0434\u0430\u0447 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e), \u0441 \u0432\u044b\u0445\u043e\u0434\u043e\u043c ios 6 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u043e\u0441\u044c. Core Image \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043a\u0430\u043a \u043d\u0430 CPU, \u0442\u0430\u043a \u0438 \u043d\u0430 GPU.<\/p>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 GPUImage \u043d\u0430\u0434 Core Image:<\/p>\n<ul>\n<li>GPUImage \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c (\u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c) \u0432\u0430\u0448\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b (Core Image \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 OS X, \u043d\u0435 \u043d\u0430 iOS);<\/li>\n<li>GPUImage \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0447\u0435\u043c Core Image;<\/li>\n<li>GPUImage \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u044f\u0437\u044b\u043a GLSL \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430;<\/li>\n<li>GPUImage \u044d\u0442\u043e Open Source;<\/li>\n<\/ul>\n<p>  GPUImage \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0435\u0449\u0435 \u0438 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 OpenGL, \u0442.\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0430\u0441\u0441\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439. \u0412\u044b \u0441\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0431\u043e\u043b\u0435\u0435 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0432\u0435\u0449\u0430\u043c, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043d\u043e\u0432\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432, \u0438 \u0443\u0436\u0435 \u0432 \u0441\u043a\u043e\u0440\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b!<\/p>\n<h4>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 GPUImage<\/h4>\n<p>  GPUImage \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0443\u0442\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0435\u0439 \u043d\u0430 Objective-C \u0432\u043e\u043a\u0440\u0443\u0433 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430. \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u0431\u0443\u0434\u044c \u0442\u043e \u043a\u0430\u043c\u0435\u0440\u0430, \u0441\u0435\u0442\u044c \u0438\u043b\u0438 \u0434\u0438\u0441\u043a, \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u044f \u0447\u0435\u0440\u0435\u0437 \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0438 \u0432\u044b\u0434\u0430\u0432\u0430\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (UIImage), \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d (\u0447\u0435\u0440\u0435\u0437 GPUImageVIew) \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/c22\/dbd\/c08\/c22dbdc0866c7a7c1dc2c61889e5111c.png\"\/><\/p>\n<p>  \u0413\u043e\u0432\u043e\u0440\u044f \u0434\u0440\u0443\u0433\u0438\u043c \u044f\u0437\u044b\u043a\u043e\u043c, \u0432 API GPUImage \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u044b \u0442\u044b\u0441\u044f\u0447\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043a\u0430\u043c\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438 \u0436\u0434\u0443\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<br \/>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e \u0441 \u0432\u0438\u0434\u0435\u043e \u043a\u0430\u043c\u0435\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 <i>Color Levels<\/i> \u0434\u043b\u044f \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u0438\u0434\u043e\u0432 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0439 \u0441\u043b\u0435\u043f\u043e\u0442\u044b \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0438\u0445 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Color Levels<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">GPUImageVideoCamera *videoCamera = [[GPUImageVideoCamera alloc]     initWithSessionPreset:AVCaptureSessionPreset640x480            cameraPosition:AVCaptureDevicePositionBack]; videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;  GPUImageFilter *filter = [[GPUImageLevelsFilter alloc] initWithFragmentShaderFromFile:@&quot;CustomShader&quot;]; [filter setRedMin:0.299 gamma:1.0 max:1.0 minOut:0.0 maxOut:1.0]; [filter setGreenMin:0.587 gamma:1.0 max:1.0 minOut:0.0 maxOut:1.0]; [filter setBlueMin:0.114 gamma:1.0 max:1.0 minOut:0.0 maxOut:1.0]; [videoCamera addTarget:filter];  GPUImageView *filteredVideoView = [[GPUImageView alloc] initWithFrame:self.view.bounds)]; [filter addTarget:filteredVideoView]; [self.view addSubView:filteredVideoView];  [videoCamera startCameraCapture] <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u0435\u0440\u044c\u0435\u0437\u043d\u043e, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0434\u0435\u0442 \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0434\u043b\u044f GPUImage \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u043e \u043d\u0430 Apple Store \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e 3,99 $ \u0431\u0435\u0437\u043e \u0432\u0441\u044f\u043a\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. \u0410 \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0442\u0432\u0438\u0442\u0442\u0435\u0440\u0430 \u0438 \u043f\u0430\u0440\u0443 \u0437\u0432\u0443\u043a\u043e\u0432\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0446\u0435\u043d\u0443 \u0438 \u0434\u043e \u043a\u0430\u043a\u0438\u0445-\u0442\u043e 6,99$.<\/p>\n<h4>\u0412\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0435 \u0448\u0435\u0439\u0434\u0435\u0440\u044b GPUImage<\/h4>\n<p>  <i>\u0428\u0435\u0439\u0434\u0435\u0440<\/i> \u2014 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043b\u044f \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. <br \/>  \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u0441\u043d\u0435\u043c\u0441\u044f \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0445 \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432.<br \/>  \u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438. \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f OpenGL, \u0442.\u043a. \u0432\u0441\u0451 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0442\u0440\u0435\u0445\u043c\u0435\u0440\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435. \u0415\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0447\u0442\u043e-\u0442\u043e \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c, \u0442\u043e \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c, \u0433\u0434\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c. OpenGL ES 2.0 \u043c\u043e\u0436\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 (\u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u043e\u0447\u043a\u0438 \u0438 \u043b\u0438\u043d\u0438\u0438, \u043d\u043e \u043d\u0435 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432.<br \/>  \u0412\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0435 \u0448\u0435\u0439\u0434\u0435\u0440\u044b \u2014 \u044d\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u041e\u0414\u041d\u041e\u0419 \u0432\u0435\u0440\u0448\u0438\u043d\u044b.<br \/>  \u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 \u043d\u0430 GPUImage:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">attribute vec4 position; attribute vec4 inputTextureCoordinate; varying vec2 textureCoordinate;  void main() {    gl_Position = position;    textureCoordinate = inputTextureCoordinate.xy; }  <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0412 \u0448\u0435\u0439\u0434\u0435\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0442\u0440\u0438 \u0442\u0438\u043f\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445: attributes, varyings, and uniforms. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u2014 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b (\u043a\u0430\u043a \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0444\u0438\u0433\u0443\u0440\u0443), \u0446\u0432\u0435\u0442, \u043d\u043e\u0440\u043c\u0430\u043b\u044c \u0438.\u0442.\u0434<br \/>  Varying-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u043c \u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u0430\u043c\u0438. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0432\u0435\u0440\u0448\u0438\u043d\u043d\u043e\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u0435 \u0438 \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043d\u044b\u0439. \u041d\u043e, \u0442.\u043a. \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u043d\u0430 \u0432\u0441\u0435\u0439 \u0444\u0438\u0433\u0443\u0440\u0435 \u2014 \u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043b\u0435\u0432\u043e\u0439 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u044b \u0444\u0438\u0433\u0443\u0440\u044b \u0438\u043c\u0435\u044e\u0442 \u0431\u0435\u043b\u044b\u0439 \u0446\u0432\u0435\u0442, \u0430 \u043f\u0440\u0430\u0432\u043e\u0439 \u2014 \u0447\u0435\u0440\u043d\u044b\u0439, \u0442\u043e \u0446\u0432\u0435\u0442 \u0444\u0438\u0433\u0443\u0440\u044b \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442 \u043e\u0442 \u0431\u0435\u043b\u043e\u0433\u043e \u043a \u0447\u0435\u0440\u043d\u043e\u043c\u0443.<br \/>  Uniforms \u2014 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043c\u0438\u0440\u043e\u043c (\u0441\u0430\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439). \u041e\u043d\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0432\u0435\u0440\u0448\u0438\u043d \u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432. <br \/>  \u0412 GPUImage \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0434\u0432\u0430 \u043d\u0430\u0431\u043e\u0440\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u2014 \u044d\u0442\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0441\u0430\u043c\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u0438 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438.<br \/>  \u041c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 \u0432 \u043d\u0430\u0448 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440, \u0430 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0430 <i>GPUImageFilter<\/i>.<\/p>\n<h4>C\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 GPUImage<\/h4>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f iphone. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c: File-&gt; Project \u2192 Single View Application. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u0433\u0430\u043b\u043e\u0447\u043a\u0443 \u0441\u043e storyboards \u0438 ARC. <br \/>  \u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0432 \u043d\u0430\u0448 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 (\u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u043c\u044b\u0448\u0438 \u043f\u043e \u043f\u0430\u043f\u043a\u0435 \u0441 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c \u2192 Add files). \u0417\u0430\u0442\u0435\u043c \u043d\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/236\/869\/c55\/236869c55e265ba843dc507d0495253b.png\"\/><br \/>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u043b\u0430\u0433 -ObjC \u043a \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0444\u043b\u0430\u0433\u0430\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0441 GPUImage \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c \u0432 \u201cheader search paths\u201d. <br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0451 \u0433\u043e\u0442\u043e\u0432\u043e \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430! \u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0448\u0435\u0439\u0434\u0435\u0440 <b>polar pixellate<\/b> \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0435\u0433\u043e, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0441\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (\u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u044b\u0445 \u0446\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435). <\/p>\n<h4>\u0424\u0438\u043b\u044c\u0442\u0440 Polar Pixellate Posterize<\/h4>\n<p>  \u041d\u0430\u0448 \u0444\u0438\u043b\u044c\u0442\u0440 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044f\u0440\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0434\u043b\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<br \/>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043e\u0442 GPUImageFilter. \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e GPUImagePolarPixellatePosterizeFilter.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">GPUImageFilter<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">#import &quot;GPUImageFilter.h&quot;   @interface GPUImagePolarPixellateFilterPosertize : GPUImageFilter {     GLint centerUniform, pixelSizeUniform; }   \/\/ The center about which to apply the distortion, with a default of (0.5, 0.5) @property(readwrite, nonatomic) CGPoint center; \/\/ The amount of distortion to apply, from (-2.0, -2.0) to (2.0, 2.0), with a default of (0.05, 0.05) @property(readwrite, nonatomic) CGSize pixelSize;   @end  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0432\u0435 uniform-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u044d\u0442\u043e\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0435. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f centerUniform \u2014 \u044d\u0442\u043e \u0442\u043e\u0447\u043a\u0430, \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0435\u0440\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u043e \u043f\u043e\u043b\u044f\u0440\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u2014 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044d\u0442\u043e 0.5, 0.5, \u0442.\u0435 \u0446\u0435\u043d\u0442\u0440 \u044d\u043a\u0440\u0430\u043d\u0430. \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0432 OpenGL \u043a\u043e\u043b\u0435\u0431\u043b\u0435\u0442\u0441\u044f \u043e\u0442 0.0, 0.0 \u0434\u043e 1.0, 1.0 \u0441 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0432 \u043d\u0438\u0436\u043d\u0435\u043c \u043b\u0435\u0432\u043e\u043c \u0443\u0433\u043b\u0443 (\u043f\u0440\u0438\u043c. \u0440\u0435\u0447\u044c \u043e \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u0445). \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 pixellate \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0431\u0443\u0434\u0443\u0442 &#8216;\u043f\u0438\u043a\u0441\u0435\u043b\u0438&#8217; \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u044f\u0440\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00abx\u00bb \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0434\u0438\u0443\u0441\u043e\u043c (\u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043e\u0442 \u00ab\u0446\u0435\u043d\u0442\u0440\u0430\u00bb), \u0430 \u0434\u0440\u0443\u0433\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0443\u0433\u043e\u043b \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445.<br \/>  \u0418 \u0445\u043e\u0442\u044f GPUImageFilter \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 OpenGL \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0444\u0440\u0435\u0439\u043c\u0431\u0443\u0444\u0435\u0440\u043e\u0432, \u043d\u0430\u043c \u0432\u0441\u0435 \u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c \u0448\u0435\u0439\u0434\u0435\u0440 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 uniform-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435.<\/p>\n<h4>\u041d\u0430\u0448 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440<\/h4>\n<p>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u043f\u0435\u0440\u0435\u0434 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 @ implementation:   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Code<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">NSString *const kGPUImagePolarPixellatePosterizeFragmentShaderString = SHADER_STRING (  varying highp vec2 textureCoordinate;  uniform highp vec2 center;  uniform highp vec2 pixelSize;  uniform sampler2D inputImageTexture;    void main()  {      highp vec2 normCoord = 2.0 * textureCoordinate - 1.0;      highp vec2 normCenter = 2.0 * center - 1.0;        normCoord -= normCenter;        highp float r = length(normCoord); \/\/ to polar coords      highp float phi = atan(normCoord.y, normCoord.x); \/\/ to polar coords        r = r - mod(r, pixelSize.x) + 0.03;      phi = phi - mod(phi, pixelSize.y);        normCoord.x = r * cos(phi);      normCoord.y = r * sin(phi);        normCoord += normCenter;        mediump vec2 textureCoordinateToUse = normCoord \/ 2.0 + 0.5;      mediump vec4 color = texture2D(inputImageTexture, textureCoordinateToUse );             color = color - mod(color, 0.1);      gl_FragColor = color;   }  );  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u043e\u0434 \u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d \u0432 \u043c\u0430\u043a\u0440\u043e\u0441 SHADER_STRING(), \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 NSString.<br \/>  \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0432 \u043e \u0442\u0438\u043f\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u0432 GLSL. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u044d\u0442\u043e int, float, vector (vec2, vec3, vec4) \u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b (mat2, mat3, mat4). \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430\u0434 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 \u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 vec2+ vec2. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043d\u0430 \u0447\u0438\u0441\u043b\u043e (int \u0438\u043b\u0438 float), \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443: float*vec2 = vec2.x*float, vec2.y*float. \u0415\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435: vec4.xyz, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c vec3. \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"http:\/\/iphonedevelopment.blogspot.ru\/2010\/11\/opengl-es-20-for-ios-chapter-4.html\">\u0442\u0443\u0442<\/a>.<br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u0436\u0435 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. Varying textureCoordinate \u0442\u0438\u043f\u0430 vec2 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043a \u043d\u0430\u043c \u0438\u0437 \u0432\u0435\u0440\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. Uniform \u2014 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 center \u0438 pixelSize \u2014 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430-\u0444\u0438\u043b\u044c\u0442\u0440\u0430. \u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f inputImageTexture \u0442\u0438\u043f\u0430 sampler2D. \u042d\u0442\u0430 uniform \u2014 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0443 \u0441\u0443\u043f\u0435\u0440\u043a\u043b\u0430\u0441\u0441\u0430, GPUImageFilter, \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0434\u0432\u0443\u0445\u043c\u0435\u0440\u043d\u0443\u044e \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. <br \/>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u044b \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 highp. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u043a\u0430\u0437\u0430\u0442\u044c GLSL \u043e\u0431 \u0443\u0440\u043e\u0432\u043d\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0448\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0443 \u043d\u0430\u0448\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u2014 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0440\u0435\u043d\u0434\u0435\u0440\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0441\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0438 \u043c\u0435\u043d\u044c\u0448\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0431\u044b\u0432\u0430\u044e\u0442 lowp, mediump, highp. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u0445 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"http:\/\/db-in.com\/blog\/2011\/02\/all-about-opengl-es-2-x-part-23\/\">\u0442\u0443\u0442<\/a>.<br \/>  \u0428\u0435\u0439\u0434\u0435\u0440 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043c\u0435\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e main (). \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0446\u0432\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430. \u0414\u0430\u043d\u043d\u044b\u0439 \u0446\u0432\u0435\u0442 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c normCoord. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u044d\u0442\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432 \u043f\u043e\u043b\u044f\u0440\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c, \u044d\u0442\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043d\u0430\u0448\u0443 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441 \u043f\u043e\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f TextureCoordinate \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u043d\u0430 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0435 \u043e\u0442 0.0, 0.0 \u0434\u043e 1.0, 1.0. Uniform-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f Center \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0432 \u0442\u043e\u043c \u0436\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435. \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430\u0448 \u044d\u043a\u0440\u0430\u043d \u0432 \u043f\u043e\u043b\u044f\u0440\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u0445 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043e\u0442 -1.0, -1.0 \u0434\u043e 1.0, 1.0. \u041f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435. \u0422\u0440\u0435\u0442\u044c\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u0442 \u0438\u0437 \u0446\u0435\u043d\u0442\u0440\u0430 normCoord. \u0422.\u0435. \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u043b\u0438 \u0441\u0434\u0432\u0438\u0433 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u043d\u043e\u0432\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0441 \u0446\u0435\u043d\u0442\u0440\u043e\u043c \u0432 normCoord. \u041d\u0430\u0439\u0434\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0434\u0438\u0443\u0441\u0430 \u0438 \u0443\u0433\u043b\u0430 phi, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043c\u044b \u0441\u043d\u043e\u0432\u0430 \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u0432 \u0434\u0435\u043a\u0430\u0440\u0442\u043e\u0432\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442, \u0441\u043c\u0435\u0441\u0442\u0438\u0432 \u0435\u0451 \u0446\u0435\u043d\u0442\u0440 \u043d\u0430 \u043f\u0440\u0435\u0436\u043d\u0435\u0435 \u043c\u0435\u0441\u0442\u043e. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d 0.0, 0.0 1.0, 1.0, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u0443\u0440. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e texture2D(), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: \u0434\u0432\u0443\u0445\u043c\u0435\u0440\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442-\u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 inputImage) \u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b (textureCoordinateToUse).<br \/>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u043c \u0446\u0432\u0435\u0442\u043e\u0432\u0443\u044e \u0433\u0430\u043c\u043c\u0443 \u0434\u043b\u044f \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e, \u0437\u0435\u043b\u0435\u043d\u043e\u0433\u043e, \u0441\u0438\u043d\u0435\u0433\u043e (\u0438 \u0430\u043b\u044c\u0444\u0430, \u043d\u043e \u0430\u043b\u044c\u0444\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 1,0 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u043a &#8230;) \u043e\u0442 256 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 (16,8 \u043c\u043b\u043d. \u0446\u0432\u0435\u0442\u043e\u0432) \u0434\u043e 10 (1000 \u0446\u0432\u0435\u0442\u043e\u0432 ).<br \/>  \u042d\u0442\u043e \u043d\u0430\u0448 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 \u0438 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e. \u0415\u0441\u043b\u0438 \u0431\u044b \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0443 \u0436\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 (CPU) \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0446\u0435\u043b\u0438, \u0442\u043e \u044d\u0442\u043e \u0437\u0430\u043d\u044f\u043b\u043e \u0431\u044b \u043a\u0443\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0412\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043d\u0430 GPU \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e \u0432\u0438\u0434\u0435\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c CPU.<\/p>\n<h4>\u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0444\u0438\u043b\u044c\u0442\u0440\u0430<\/h4>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0448\u0435\u0439\u0434\u0435\u0440, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u2014 \u044d\u0442\u043e setter&#8217;\u044b \u0434\u043b\u044f uniform \u2014 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u041f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432 \u0441\u0443\u043f\u0435\u0440\u043a\u043b\u0430\u0441\u0441 \u0442\u0435\u043a\u0441\u0442 \u0448\u0435\u0439\u0434\u0435\u0440\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 uniform \u2014 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438 \u0437\u0430\u0434\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<br \/>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u043f\u043e\u0441\u043b\u0435 @implementation:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Code<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">@synthesize center = _center; @synthesize pixelSize = _pixelSize;   #pragma mark - #pragma mark Initialization and teardown - (id)init {     if (!(self = [super initWithFragmentShaderFromString:kGPUImagePolarPixellatePosterizeFragmentShaderString])) {                 return nil;     }          pixelSizeUniform = [filterProgram uniformIndex:@&quot;pixelSize&quot;];     centerUniform = [filterProgram uniformIndex:@&quot;center&quot;];          self.pixelSize = CGSizeMake(0.05, 0.05);     self.center = CGPointMake(0.5, 0.5);          return self; }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 initWithFragmentShaderFromString \u043d\u0430\u0448 \u0448\u0435\u0439\u0434\u0435\u0440 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0431\u044b\u043b \u0433\u043e\u0442\u043e\u0432 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043d\u0430 GPU. \u0415\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0445\u043e\u0442\u0435\u043b\u0438 \u043f\u043e\u0434\u0430\u0442\u044c \u0432\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440, \u0442\u043e \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0432\u044b\u0437\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0439\u0442\u0438 \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<br \/>  \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0437\u0432\u0430\u0442\u044c [filterProgram uniformIndex:] \u0434\u043b\u044f \u043a\u0430\u0436\u043e\u0439 uniform \u2014 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439\u0441\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u0435. \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0442\u0438\u043f\u0430 Glint \u043d\u0430 Uniform-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. <br \/>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448 \u0444\u0438\u043b\u044c\u0442\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0431\u0435\u0437 \u0443\u0447\u0430\u0441\u0442\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<br \/>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0437\u0430\u0434\u0430\u0442\u044c setter&#8217;\u044b \u0438 getter&#8217;\u044b \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 uniform \u2013 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Code<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">- (void)setPixelSize:(CGSize)pixelSize {     _pixelSize = pixelSize;     [self setSize:pixelSize forUniform: pixelSizeUniform program:filterProgram]; }   - (void)setCenter:(CGPoint)newValue; {     _center = newValue;     [self setPoint:newValue forUniform: centerUniform program:filterProgram]; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0438\u0434\u0435\u043e. \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u043a\u043b\u0430\u0441\u0441 View Controller \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0432\u0437\u044f\u043b\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0440\u0430\u043d\u0435\u0435. \u0418\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Code<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">#import &quot;JGViewController.h&quot; #import &quot;GPUImage.h&quot; #import &quot;GPUImagePolarPixellatePosterizeFilter.h&quot;   @interface JGViewController () {     GPUImageVideoCamera *vc;     GPUImagePolarPixellatePosterizeFilter *ppf; }   @end   @implementation JGViewController   - (void)viewDidLoad {     [super viewDidLoad];     vc = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack ];     vc.outputImageOrientation = UIInterfaceOrientationPortrait;     ppf = [[GPUImagePolarPixellatePosterizeFilter alloc] init];     [vc addTarget:ppf];     GPUImageView *v = [[GPUImageView alloc] init];     [ppf addTarget:v];     self.view = v;      [vc startCameraCapture]; }   -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {     CGPoint location = [[touches anyObject] locationInView:self.view];     CGSize pixelS = CGSizeMake(location.x \/ self.view.bounds.size.width * 0.5, location.y \/ self.view.bounds.size.height * 0.5);     [ppf setPixelSize:pixelS]; }   -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {     CGPoint location = [[touches anyObject] locationInView:self.view];     CGSize pixelS = CGSizeMake(location.x \/ self.view.bounds.size.width * 0.5, location.y \/ self.view.bounds.size.height * 0.5);     [ppf setPixelSize:pixelS]; }  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u043c\u0435\u0440\u0443 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c GPUImageVideoCamera \u0438 \u043d\u0430\u0448 \u0444\u0438\u043b\u044c\u0442\u0440 GPUImagePolarPixellatePosterizeFilter. <br \/>  \u0418 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c GPUImageView \u043a\u0430\u043a \u0433\u043b\u0430\u0432\u043d\u043e\u0435 view \u043d\u0430\u0448\u0435\u0433\u043e view-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. <br \/>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0430\u0448 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0432\u0438\u0434\u0435\u043e \u0441 \u043a\u0430\u043c\u0435\u0440\u044b \u2014 \u0444\u0438\u043b\u044c\u0442\u0440 \u043f\u0438\u043ac\u0435\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (polarpixellateposterizefilter) \u2014 GPUImageView, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u0435\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430.<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u043c\u044b \u0443\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0444\u0438\u043b\u044c\u0442\u0440. \u041d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c! \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u044b <i>touchesmoved<\/i> \u0438 <i>touchesbegan<\/i>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u044e\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u0435, \u0432\u043b\u0438\u044f\u044f \u043d\u0430 uniform-\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e pixelSize \u043d\u0430\u0448\u0435\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430.<br \/>  \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 &#8216;\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439&#8217; \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u0442\u0440\u043e\u043d\u0443\u0442\u044c\u0441\u044f \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u043b\u0435\u0432\u043e\u043c \u0443\u0433\u043b\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0430 \u0434\u043b\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u2014 \u0432 \u043d\u0438\u0436\u043d\u0435\u043c \u043f\u0440\u0430\u0432\u043e\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u043c, \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. <br \/>  \u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u044e! \u0412\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0441\u0432\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440!<\/p>\n<h4>\u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432<\/h4>\n<p>  \u0423\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0438 \u0437\u0435\u043b\u0435\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430 \u0432 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438, \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u043d\u0435\u0433\u043e:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Code<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">lowp vec4 color = sampler2D(inputImageTexture, textureCoordinate); lowp vec4 alter = vec4(0.1, 0.5, 1.5, 1.0); gl_FragColor = color * alter; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0423\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u044f\u0440\u043a\u043e\u0441\u0442\u0438:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Code<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); gl_FragColor = vec4((textureColor.rgb + vec3(-0.5)), textureColor.w);  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Code<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">mediump float texelWidthOffset = 0.01;  mediump float texelHeightOffset = 0.01;    vec2 firstOffset = vec2(1.5 * texelWidthOffset, 1.5 * texelHeightOffset); vec2 secondOffset = vec2(3.5 * texelWidthOffset, 3.5 * texelHeightOffset);   mediump oneStepLeftTextureCoordinate = inputTextureCoordinate - firstOffset; mediump twoStepsLeftTextureCoordinate = inputTextureCoordinate - secondOffset; mediump oneStepRightTextureCoordinate = inputTextureCoordinate + firstOffset; mediump twoStepsRightTextureCoordinate = inputTextureCoordinate + secondOffset;   mediump vec4 fragmentColor = texture2D(inputImageTexture, inputTextureCoordinate) * 0.2; fragmentColor += texture2D(inputImageTexture, oneStepLeftTextureCoordinate) * 0.2; fragmentColor += texture2D(inputImageTexture, oneStepRightTextureCoordinate) * 0.2; fragmentColor += texture2D(inputImageTexture, twoStepsLeftTextureCoordinate) * 0.2; fragmentColor += texture2D(inputImageTexture, twoStepsRightTextureCoordinate) * 0.2; gl_FragColor = fragmentColor;  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 GPUImage \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0438 \u043e\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043e\u0449\u043d\u044b\u0439 \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u043f\u043b\u043e\u0442\u0438\u0442\u044c \u0432\u0441\u0451 \u0442\u043e, \u043e \u0447\u0435\u043c \u0432\u044b \u043c\u0435\u0447\u0442\u0430\u043b\u0438. \u0418 \u0434\u0430\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, GPUImage \u2014 \u044d\u0442\u043e \u0433\u043e\u043b\u043e\u0432\u043e\u043a\u0440\u0443\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432, \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0440\u0435\u0436\u0438\u043c\u044b \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u044f, \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0447\u0442\u0430\u0442\u044c (\u0438\u043b\u0438 \u0436\u0435 \u0434\u0430\u0436\u0435 \u043d\u0435 \u0437\u043d\u0430\u043b\u0438 \u043e \u0438\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0438). \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043a\u0443\u0447\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0445 \u0432 \u0441\u0435\u0431\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0443\u0440\u043e\u0432, \u00ab\u0440\u044b\u0431\u0438\u0439 \u0433\u043b\u0430\u0437\u00bb \u0438 \u0442\u043e\u043d\u043d\u0443 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u0440\u0443\u0442\u044b\u0445 \u0448\u0442\u0443\u043a.<br \/>  <a href=\"https:\/\/bitbucket.org\/brovik\/gpuimage-sample-project\/src\/031f2d9f0693edd12a3f1fbcfc6b9314223146ed?at=master\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438<\/a><br \/>  \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 OpenGL ES 2.0 (GLSL) \u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430: <a href=\"http:\/\/www.raywenderlich.com\/3664\/opengl-es-2-0-for-iphone-tutorial\">\u0440\u0430\u0437<\/a>, <a href=\"http:\/\/db-in.com\/blog\/2011\/02\/all-about-opengl-es-2-x-part-23\/\">\u0434\u0432\u0430<\/a>, <a href=\"http:\/\/iphonedevelopment.blogspot.ru\/2010\/11\/opengl-es-20-for-ios-chapter-4.html\">\u0442\u0440\u0438<\/a>.<br \/>  \u0421\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0432\u043e\u0440\u0447\u0435\u0441\u043a\u043e\u0439 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0435\u0439 \u0441 \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0437\u043d\u0430\u043d\u0438\u0439 \u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c: <a href=\"http:\/\/indieambitions.com\/idevblogaday\/learning-opengl-gpuimage\/\">\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a 1<\/a>, <a href=\"http:\/\/nshipster.com\/gpuimage\/\">\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a 2<\/a>    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/181794\/\"> http:\/\/habrahabr.ru\/post\/181794\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/467\/333\/586\/467333586cfe4711a12a20a6c6d014c6.png\"\/><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f iphone, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0441 \u043a\u0430\u043c\u0435\u0440\u044b \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c GPUImage \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 \u043d\u0430 OpenGL ES \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-181794","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/181794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=181794"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/181794\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=181794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=181794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=181794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}