{"id":176,"date":"2015-02-01T20:54:34","date_gmt":"2015-02-01T11:54:34","guid":{"rendered":"http:\/\/blog.barbayar.net\/?p=176"},"modified":"2015-02-01T20:54:34","modified_gmt":"2015-02-01T11:54:34","slug":"opengl-c","status":"publish","type":"post","link":"https:\/\/blog.barbayar.net\/?p=176","title":{"rendered":"OpenGL \/ C++"},"content":{"rendered":"<p>\u0421\u04af\u04af\u043b\u0438\u0439\u043d \u0445\u044d\u0434 \u0445\u043e\u043d\u043e\u0433 \u0441\u0443\u0440\u0441\u0430\u043d \u0437\u04af\u0439\u043b\u044d\u044d \u0445\u0443\u0432\u0430\u0430\u043b\u0446\u044a\u044f.<br \/>\n\u0425\u044d\u043b\u0442\u0441\u044d\u044d \u0441\u043e\u043b\u0438\u0441\u043e\u043d \u0433\u044d\u0436 \u0445\u044d\u043b\u0441\u044d\u043d \u0431\u0438\u043b\u04af\u04af, \u04af\u0433\u04af\u0439 \u0431\u0438\u043b\u04af\u04af. Front-end engineer \u0431\u043e\u043b\u0441\u043e\u043d. \u04e8\u043c\u043d\u04e9 \u043d\u044c front-end \u0431\u0430\u0439\u0441\u0430\u043d \u043b \u0434\u0430\u0430, \u0445\u044d\u0441\u044d\u0433 back-end \u0431\u0430\u0439\u0436 \u0431\u0430\u0439\u0433\u0430\u0430\u0434 \u044d\u0440\u0433\u044d\u044d\u0434 front-end \u0431\u043e\u043b\u0436 \u0431\u0430\u0439\u0433\u0430\u0430 \u0441\u0430\u043d\u0430\u0430\u0442\u0430\u0439.<br \/>\n\u0428\u0438\u043d\u044d \u0445\u044d\u043b\u0442\u044d\u0441 native \u0442\u043e\u0433\u043b\u043e\u043e\u043c \u0445\u0438\u0439\u0434\u044d\u0433 \u0445\u044d\u043b\u0442\u044d\u0441 \u0431\u043e\u043b\u043e\u0445\u043e\u043e\u0440, OpenGL, \u0431\u043e\u043b\u043e\u043d C++ \u0445\u044d\u0440\u044d\u0433\u043b\u044d\u0434\u044d\u0433 \u044e\u043c. \u0410\u043b\u044c \u0430\u043b\u0438\u043d\u0438\u0439\u0433 \u043d\u044c \u0445\u0438\u0439\u0436 \u0431\u0430\u0439\u0441\u0430\u043d, \u0442\u044d\u0433\u044d\u0445\u0434\u044d\u044d \u043e\u043b\u043e\u043d \u0436\u0438\u043b\u0438\u0439\u043d \u04e9\u043c\u043d\u04e9. \u0422\u044d\u0433\u044d\u044d\u0434 \u0441\u0430\u044f \u0445\u044d\u0434 \u0445\u043e\u043d\u043e\u0433 \u0441\u044d\u0440\u0433\u044d\u044d\u043d\u0433\u044d\u044d \u0448\u0438\u043d\u044d \u0437\u04af\u0439\u043b \u0441\u0443\u0440\u0447 \u0430\u0432\u043b\u0430\u0430.<\/p>\n<p>\u042d\u0445\u043b\u044d\u044d\u0434 \u044d\u043d\u0433\u0438\u0439\u043d \u0437\u04af\u0439\u043b\u044d\u044d\u0441 \u044d\u0445\u043b\u044c\u0435. \u0422\u043e\u0433\u043b\u043e\u043e\u043c\u043e\u043d\u0434, FPS(frames per second) \u0433\u044d\u0436 \u04af\u0433 \u0431\u0438\u0439. \u0416\u0438\u0448\u044d\u044d \u043d\u044c 60fps. \u042d\u043d\u044d \u043d\u044c \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0434 60 \u0443\u0434\u0430\u0430 \u0437\u0443\u0440\u043d\u0430 \u0433\u044d\u0441\u044d\u043d \u04af\u0433. \u04e8\u04e9\u0440\u04e9\u04e9\u0440 \u0445\u044d\u043b\u0431\u044d\u043b 16 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0434 \u0447\u0438\u043d\u0438\u0439 \u0431\u04af\u0445 \u0442\u043e\u043e\u0446\u043e\u043e, \u0431\u043e\u0434\u043e\u043b\u0442 \u043d\u0442\u0440 \u0447\u0438\u043d\u044c \u0434\u0443\u0443\u0441\u0430\u0430\u0434 \u0437\u0443\u0440\u0430\u0445 \u0437\u04af\u0439\u043b\u04af\u04af\u0434 \u0447\u0438\u043d\u044c \u0431\u044d\u043b\u044d\u043d \u0431\u0430\u0439\u0445 \u0451\u0441\u0442\u043e\u0439 \u0433\u044d\u0441\u044d\u043d \u04af\u0433 \u044e\u043c. \u0422\u044d\u0433\u044d\u0445\u044d\u044d\u0440 performance \u0442\u0430\u043b \u0434\u044d\u044d\u0440 \u0441\u0430\u0439\u043d \u0430\u0436\u0438\u043b\u043b\u0430\u0445 \u0451\u0441\u0442\u043e\u0439. \u042f\u043c\u0430\u0440 \u043d\u044d\u0433\u044d\u043d data-\u0440\u0443\u0443 \u0445\u0430\u043d\u0434\u0430\u043b\u0442 \u0445\u0438\u0439\u0445 \u04af\u0435\u0434 loop \u0435\u0440\u04e9\u04e9\u0441\u04e9\u04e9 \u0445\u044d\u0440\u044d\u0433\u043b\u044d\u0436 \u0431\u043e\u043b\u043e\u0445\u0433\u04af\u0439, \u0434\u0430\u043d\u0434\u0430\u0430 O(1)-\u044d\u044d\u0440 \u0445\u0430\u043d\u0434\u0430\u0445 \u0451\u0441\u0442\u043e\u0439. \u04ae\u04af\u043d\u0438\u0439 \u0442\u0443\u043b\u0434, vector, hash, set \u0433\u044d\u0445 \u043c\u044d\u0442 \u04e9\u0433\u04e9\u0433\u0434\u043b\u0438\u0439\u043d \u0431\u04af\u0442\u0446\u04af\u04af\u0434\u0438\u0439\u0433 \u0430\u0448\u0438\u0433\u043b\u0430\u043d\u0430. STL \u0434\u044d\u044d\u0440 \u0431\u04af\u0433\u0434 \u0431\u044d\u043b\u044d\u043d \u0431\u0430\u0439\u0433\u0430\u0430.<\/p>\n<div>\n<p>\u0422\u044d\u0433\u044d\u044d\u0434 \u0434\u044d\u044d\u0440\u044d\u044d\u0441 \u043d\u044c, \u0441\u04af\u04af\u043b\u0438\u0439\u043d \u04af\u0435\u0438\u0439\u043d PC-\u04af\u04af\u0434 \u0434\u0430\u043d\u0434\u0430\u0430 multi-core \u0431\u043e\u043b\u0441\u043e\u043d. \u0422\u043e\u0433\u043b\u043e\u043e\u043c\u043d\u044b OpenGL \u0431\u043e\u043b\u043e\u0432\u0441\u0440\u0443\u0443\u043b\u0430\u0445 \u0445\u044d\u0441\u044d\u0433(\u0442\u043e\u0433\u043b\u043e\u043e\u043c \u0433\u044d\u043b\u0442\u0433\u04af\u0439, app-\u044b\u043d core animation \u0445\u044d\u0441\u044d\u0433), \u0435\u0440\u04e9\u043d\u0445\u0438\u0439\u0434\u04e9\u04e9 main thread \u0434\u044d\u044d\u0440 \u0431\u043e\u043b\u043e\u0432\u0441\u0440\u0443\u0443\u043b\u0430\u043b\u0442 \u0445\u0438\u0439\u0433\u0434\u0434\u044d\u0433 \u044e\u043c. \u0411\u04af\u0445 default event-\u04af\u04af\u0434, update method-\u0443\u0443\u0434 main thread \u0434\u044d\u044d\u0440 \u0434\u0443\u0443\u0434\u0430\u0433\u0434\u0430\u043d\u0430. \u0422\u044d\u0433\u044d\u0445\u044d\u044d\u0440 \u0442\u044d\u0440 \u0434\u043e\u0442\u043e\u0440 \u0448\u0443\u0443\u0434 \u0431\u043e\u0434\u043e\u043b\u0442 \u044d\u0441\u0432\u044d\u043b data \u0431\u043e\u043b\u043e\u0432\u0441\u0440\u0443\u0443\u043b\u0430\u043b\u0442 \u0445\u0438\u0439\u0432\u044d\u043b, main thread \u0447\u0438\u043d\u044c \u0443\u043b\u0430\u043c \u043b \u0445\u043e\u0446\u0440\u043e\u0445 \u0431\u0443\u044e\u0443 \u043d\u04e9\u0433\u04e9\u04e9 16 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044d\u044d\u0441 \u0447\u0438\u043d\u044c \u0445\u043e\u0440\u043e\u0433\u0434\u043e\u043e\u0434 \u044f\u0432\u043d\u0430 \u043b \u0433\u044d\u0441\u044d\u043d \u04af\u0433. \u0422\u044d\u0433\u044d\u0445\u044d\u044d\u0440 multi-core \u043e\u043e \u0430\u0448\u0438\u0433\u043b\u0430\u0430\u0434 \u04e9\u04e9\u0440 thread \u0434\u044d\u044d\u0440 \u0431\u043e\u043b\u043e\u0432\u0441\u0440\u0443\u0443\u043b\u0430\u043b\u0442 \u0445\u0438\u0439\u0432\u044d\u043b, \u0442\u043e\u043b\u0433\u043e\u043e\u043c\u044b\u043d \u0434\u043e\u0442\u043e\u043e\u0434 \u0431\u043e\u043b\u043e\u0432\u0441\u0440\u0443\u0443\u043b\u0430\u043b\u0442 \u0447\u0438\u043d\u044c, OpenGL \u0442\u044d\u0439\u0433\u044d\u044d \u0437\u044d\u0440\u044d\u0433\u0446\u044d\u0436 \u0430\u0436\u0438\u043b\u043b\u0430\u043d\u0430, \u043c\u04e9\u043d \u0442\u043e\u043e\u0446\u043e\u043e \u0434\u0443\u0443\u0441\u0447 \u0430\u043c\u0436\u0430\u0430\u0433\u04af\u0439 \u0431\u0430\u0439\u0441\u0430\u043d \u0447, frame-\u044d\u044d \u0437\u0443\u0440\u0430\u0430\u0434 \u0431\u0430\u0439\u0445 \u0431\u043e\u043b\u043e\u043c\u0436 \u04af\u04af\u0441\u0447 \u0431\u0430\u0439\u0433\u0430\u0430 \u044e\u043c.<br \/>\n\u0417\u04af\u0433\u044d\u044d\u0440 \u0448\u0443\u0443\u0434 thread \u0430\u0448\u0438\u0433\u043b\u0430\u0441\u0430\u043d \u0447 \u0431\u043e\u043b\u043d\u043e, \u044d\u0441\u0432\u044d\u043b GCD(Grand Central Dispatch &lt;&#8211; my fav one) \u0433\u044d\u0445 \u043c\u044d\u0442 library \u0430\u0448\u0438\u0433\u043b\u0430\u0441\u0430\u043d \u0447 \u0431\u043e\u043b\u043d\u043e.<br \/>\n\u0422\u044d\u0433\u044d\u0445\u0434\u044d\u044d thread \u04af\u04af\u0441\u0433\u044d\u0445 \u043d\u044c \u0431\u043e\u0434\u0441\u043e\u043d \u0448\u0438\u0433 \u0431\u0430\u0441 \u0430\u043c\u0430\u0440 \u044d\u0434 \u0431\u0438\u0448. Memory management-\u044d\u044d \u0441\u0430\u0439\u043d \u0445\u0438\u0439\u0445 \u0445\u044d\u0440\u044d\u0433\u0442\u044d\u0439. 2 \u0437\u044d\u0440\u044d\u0433 \u0430\u0436\u0438\u043b\u043b\u0430\u0436 \u0431\u0430\u0439\u0433\u0430\u0430 thread 2-\u0443\u0443\u043b\u0430\u0430 \u043d\u044d\u0433 object \u0440\u0443\u0443 \u0437\u044d\u0440\u044d\u0433 \u0445\u0430\u043d\u0434\u0430\u0445 \u04af\u0435\u0434 \u044f\u043d\u0437 \u0431\u04af\u0440\u0438\u0439\u043d \u0430\u0441\u0443\u0443\u0434\u0430\u043b \u04af\u04af\u0441\u043d\u044d.<br \/>\n\u0416\u0438\u0448\u044d\u044d \u043d\u044c, Cocos2d-x \u0433\u044d\u044d\u0434 engine-\u0438\u0439 \u0445\u0443\u0432\u044c\u0434, auto releasing pool memory management-\u0442\u044d\u0439. \u0422\u044d\u0440 \u043d\u044c main thread \u0434\u044d\u044d\u0440 \u0430\u0436\u0438\u043b\u043b\u0430\u043d\u0430. \u0422\u044d\u0433\u044d\u0445\u044d\u044d\u0440 \u0436\u0438\u0448\u044d\u044d \u043d\u044c, \u043d\u044d\u0433 auto-releasing object \u04af\u04af\u0441\u0433\u044d\u044d\u0434 main thread \u0431\u0438\u0448 \u0442\u0443\u0441\u0434\u0430\u0430 thread \u0434\u044d\u044d\u0440 \u0430\u0448\u0438\u0433\u043b\u0430\u0430\u0434 \u044f\u0432\u0436 \u0431\u0430\u0439\u043b\u0430\u0430 \u0433\u044d\u0436 \u0431\u043e\u0434\u044a\u0451. \u0410\u0448\u0438\u0433\u043b\u0430\u0436 \u0431\u0430\u0439\u0445 \u0445\u0443\u0433\u0430\u0446\u0430\u0430\u043d\u0434 \u0447\u0438\u043d\u044c, main thread \u0434\u044d\u044d\u0440 \u0430\u0436\u0438\u043b\u043b\u0430\u0436 \u0431\u0430\u0439\u0433\u0430\u0430 main loop \u043d\u044d\u0433 \u0431\u04af\u0442\u044d\u043d \u0442\u043e\u0439\u0440\u043e\u043e\u0434, auto releasing object-\u0443\u0443\u0434\u0430\u0430 memory-\u043e\u043e\u0441 \u0443\u0441\u0442\u0433\u0430\u043b\u0430\u0430 \u0433\u044d\u0436 \u0431\u043e\u0434\u044a\u0451. \u0422\u044d\u0433\u0432\u044d\u043b \u043d\u04e9\u0433\u04e9\u04e9 thread \u0434\u044d\u044d\u0440 \u0447\u0438\u043d\u044c memory access \u0430\u043b\u0434\u0430\u0430 \u04af\u04af\u0441\u044d\u044d\u0434, \u0442\u043e\u0433\u043b\u043e\u043e\u043c \u0447\u0438\u043d\u044c \u0448\u0443\u0443\u0434 \u0437\u043e\u0433\u0441\u043e\u043d\u043e.<\/p>\n<p>\u0423\u0433 \u043d\u044c GCD, Objective-C \u044b\u043d \u0434\u044d\u044d\u0434 level-\u0438\u0439\u043d framework-\u0443\u0443\u0434 \u0433\u043e\u0451 \u0430\u0436\u0438\u043b\u043b\u0430\u0434\u0430\u0433 \u044e\u043c. \u04e8\u04e9\u0440\u04e9\u04e9 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0430\u0430\u0440 retain \u043d\u0442\u0440 \u0445\u0438\u0439\u0433\u044d\u044d\u0434. \u0425\u0430\u0440\u0438\u043d C++ \u0434\u044d\u044d\u0440 \u0442\u0438\u0439\u043c \u044e\u043c \u0431\u0430\u0439\u0445\u0433\u04af\u0439 \u0431\u043e\u043b\u043e\u0445\u043e\u043e\u0440, \u0442\u0438\u0439\u043c\u044d\u0440\u0445\u04af\u04af \u0437\u04af\u0439\u043b\u0441\u0438\u0439\u0433 \u0431\u04af\u0433\u0434\u0438\u0439\u0433 \u04e9\u04e9\u0440\u04e9\u04e9 \u0445\u0438\u0439\u043d\u044d.<\/p>\n<p>\u0425\u044d\u043b\u044d\u0445 \u0433\u044d\u044d\u0434 \u0431\u0430\u0439\u0433\u0430\u0430 \u0437\u04af\u0439\u043b\u0441 \u0435\u0440\u0434\u04e9\u04e9 \u043b 3<br \/>\n1. Thread \u0441\u0430\u0439\u043d \u0430\u0448\u0438\u0433\u043b\u0430<br \/>\n2. Auto-releasing object \u0438\u0439\u0433 thread \u0440\u0443\u0443 \u0434\u0430\u043c\u0436\u0443\u0443\u043b\u0430\u0445\u0430\u0434 retain \u0445\u0438\u0439, \u0445\u044d\u0440\u044d\u0433\u043b\u044d\u0436 \u0434\u0443\u0443\u0441\u0430\u0430\u0434 release \u0445\u0438\u0439<br \/>\n3. OpenGL \u0442\u044d\u0439 \u0445\u043e\u043b\u0431\u043e\u043e\u0442\u043e\u0439 process-\u0443\u0443\u0434 main thread \u0434\u044d\u044d\u0440<\/p>\n<p>\u0418\u0439\u043c\u044d\u0440\u0445\u04af\u04af \u0436\u0438\u0436\u0438\u0433 \u0437\u04af\u0439\u043b\u0441\u044d\u044d \u043c\u044d\u0434\u044d\u0445\u0433\u04af\u0439\u0433\u044d\u044d\u0441 \u0431\u043e\u043b\u043e\u043e\u0434, \u0445\u044d\u0434 \u0445\u043e\u043d\u043e\u0433 \u043d\u043e\u0439\u0440\u0433\u04af\u0439, \u044f\u043c\u0430\u0440 \u0430\u043b\u0434\u0430\u0430 \u0433\u0430\u0440\u0430\u0430\u0434 \u0431\u0430\u0439\u0433\u0430\u0430\u0433\u0438\u0439\u043d \u0443\u0447\u0440\u044b\u0433 \u043e\u043b\u043e\u0445\u0433\u04af\u0439 \u044d\u0440\u0433\u04af\u04af\u0442\u0441\u044d\u043d \u0431\u043e\u0434\u0438\u0442 \u0436\u0438\u0448\u044d\u044d \u0431\u0430\u0439\u0433\u0430\u0430 \u0442\u0443\u043b, \u0442\u0430 \u0431\u04af\u0433\u0434\u0438\u0439\u0433 \u0431\u0430\u0441 \u0431\u0438\u0442\u0433\u0438\u0439 \u0442\u044d\u0433\u0436 \u0446\u0430\u0433\u0430\u0430 \u04af\u0440\u044d\u044d\u0441\u044d\u0439 \u0433\u044d\u0436 \u0431\u043e\u0434\u0441\u043e\u043d\u0434\u043e\u043e \u0431\u0438\u0447\u043b\u044d\u044d.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u0421\u04af\u04af\u043b\u0438\u0439\u043d \u0445\u044d\u0434 \u0445\u043e\u043d\u043e\u0433 \u0441\u0443\u0440\u0441\u0430\u043d \u0437\u04af\u0439\u043b\u044d\u044d \u0445\u0443\u0432\u0430\u0430\u043b\u0446\u044a\u044f. \u0425\u044d\u043b\u0442\u0441\u044d\u044d \u0441\u043e\u043b\u0438\u0441\u043e\u043d \u0433\u044d\u0436 \u0445\u044d\u043b\u0441\u044d\u043d \u0431\u0438\u043b\u04af\u04af, \u04af\u0433\u04af\u0439 \u0431\u0438\u043b\u04af\u04af. Front-end engineer \u0431\u043e\u043b\u0441\u043e\u043d. \u04e8\u043c\u043d\u04e9 \u043d\u044c front-end \u0431\u0430\u0439\u0441\u0430\u043d \u043b \u0434\u0430\u0430, \u0445\u044d\u0441\u044d\u0433 back-end \u0431\u0430\u0439\u0436 \u0431\u0430\u0439\u0433\u0430\u0430\u0434&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.barbayar.net\/index.php?rest_route=\/wp\/v2\/posts\/176"}],"collection":[{"href":"https:\/\/blog.barbayar.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.barbayar.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.barbayar.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.barbayar.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=176"}],"version-history":[{"count":0,"href":"https:\/\/blog.barbayar.net\/index.php?rest_route=\/wp\/v2\/posts\/176\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.barbayar.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.barbayar.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.barbayar.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}