{"id":4466,"date":"2018-08-28T22:01:50","date_gmt":"2018-08-28T14:01:50","guid":{"rendered":"http:\/\/www.bookcard.net\/wordpress\/?p=4466"},"modified":"2018-10-14T21:28:42","modified_gmt":"2018-10-14T13:28:42","slug":"android_game_perspective_projection","status":"publish","type":"post","link":"https:\/\/www.bookcard.net\/wordpress\/android_game_perspective_projection\/","title":{"rendered":"Android\u904a\u6232\u4e4b\u900f\u8996\u6295\u5f71"},"content":{"rendered":"<figure id=\"attachment_4467\" aria-describedby=\"caption-attachment-4467\" style=\"width: 1200px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/08\/Android_Game_Perspective_Projection.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4467\" src=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/08\/Android_Game_Perspective_Projection.jpg\" alt=\"\" width=\"1200\" height=\"800\" srcset=\"https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/08\/Android_Game_Perspective_Projection.jpg 1200w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/08\/Android_Game_Perspective_Projection-300x200.jpg 300w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/08\/Android_Game_Perspective_Projection-768x512.jpg 768w, https:\/\/www.bookcard.net\/wordpress\/wp-content\/uploads\/2018\/08\/Android_Game_Perspective_Projection-1024x683.jpg 1024w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><figcaption id=\"caption-attachment-4467\" class=\"wp-caption-text\">Android\u904a\u6232\u4e4b\u900f\u8996\u6295\u5f71<\/figcaption><\/figure>\n<p>2D\u904a\u6232\u4f7f\u7528\u300e\u6b63\u4ea4\u6295\u5f71\u300f\u9019\u610f\u5473\u8457\u6a21\u578b\u8207\u8996\u9ede\u8ddd\u96e2\u7121\u8ad6\u591a\u9060,\u5176\u5c4f\u5e55\u5c3a\u5bf8\u5927\u5c0f\u7e3d\u70ba\u4e00\u81f3.\u800c3D\u904a\u6232\u5247\u4f7f\u7528\u300e\u900f\u8996\u6295\u5f71\u300f\u6a21\u578b\u96e2\u8996\u9ede\u8d8a\u8fd1\u5176\u5c4f\u5e55\u5c3a\u5bf8\u8d8a\u5927.\u800c\u6a21\u578b\u96e2\u8996\u9ede\u8d8a\u9060\u5176\u5c4f\u5e55\u5c3a\u5bf8\u8d8a\u7d30.<\/p>\n<p>\u5728\u300e\u6b63\u4ea4\u6295\u5f71\u300f\u5c31\u50cf\u7f6e\u8eab\u65bc\u300e\u77e9\u5f62\u76d2\u300f.\u800c\u300e\u900f\u8996\u6295\u5f71\u300f\u5c31\u50cf\u5207\u6389\u300e\u91d1\u5b57\u5854\u300f\u9802\u90e8,\u9802\u90e8\u70ba\u300e\u8fd1\u88c1\u526a\u9762\u300f\u5e95\u90e8\u70ba\u300e\u9060\u88c1\u526a\u9762\u300f.\u800c\u53e6\u5916\u56db\u9762\u5247\u5206\u5225\u70ba\u300e\u5de6\u88c1\u526a\u9762\u300f\u300e\u53f3\u88c1\u526a\u9762\u300f\u300e\u9802\u88c1\u526a\u9762\u300f\u300e\u5e95\u88c1\u526a\u9762\u300f<\/p>\n<p>\u900f\u8996\u9310\u9ad4\u7531\u56db\u500b\u53c3\u6578\u7d44\u6210<\/p>\n<p>1.\u300e\u8fd1\u88c1\u526a\u9762\u300f\u8207\u76f8\u6a5f\u77e9\u96e2<\/p>\n<p>2.\u300e\u9060\u88c1\u526a\u9762\u300f\u8207\u76f8\u6a5f\u77e9\u96e2<\/p>\n<p>3.\u8996\u53e3\u7e31\u6a6b\u6bd4,\u5373\u8996\u53e3\u300e\u8fd1\u88c1\u526a\u9762\u300f\u5bec\u9ad8\u6bd4<\/p>\n<p>4.\u300e\u8996\u5834\u300f\u6307\u5b9a\u8996\u9310\u9ad4\u5bec,\u4e5f\u5c31\u662f\u5b83\u6240\u5bb9\u7d0d\u5834\u666f<\/p>\n<p>\u684c\u9762OpenGL\u5e36\u6709GLU\u8f14\u52a9\u51fd\u5f0f\u5eab.\u800cAndroid\u7cfb\u7d71\u4e5f\u542b\u6709GLU\u5eab.\u8a2d\u7f6e\u6295\u5f71\u77e9\u9663<\/p>\n<p>GLU.gluPerspective(GL10 gl,float fieldOfView,float aspectRatio,float near,flat far);<\/p>\n<p>\u8a72\u51fd\u5f0f\u5c07\u300e\u900f\u8996\u6295\u5f71\u77e9\u9663\u300f\u8207\u7576\u524d\u77e9\u9663\u76f8\u4e58.<\/p>\n<p>gl:\u70baGL10\u5be6\u4f8b<\/p>\n<p>fieldOfView:\u8996\u5834\u89d2\u5ea6,\u4eba\u773c\u8996\u5834\u89d2\u5927\u7d0467\u5ea6.\u52a0\u6e1b\u6b64\u503c\u53ef\u8abf\u6574\u6a6b\u5411\u8996\u5bdf\u7bc4\u570d<\/p>\n<p>aspectRatio:\u8996\u53e3\u7e31\u6a6b\u6bd4,\u6b64\u503c\u70ba\u4e00\u6d6e\u9ede\u6578<\/p>\n<p>near:\u9060\u88c1\u526a\u9762\u8207\u76f8\u6a5f\u8ddd\u96e2<\/p>\n<p>far:\u8fd1\u88c1\u526a\u9762\u8207\u76f8\u6a5f\u8ddd\u96e2<\/p>\n<p>\u300e\u900f\u8996\u6295\u5f71\u300f\u4ee3\u78bc<\/p>\n<p>GL10 gl = GRAPHICS.GetGL();<\/p>\n<p>\u6e05\u5c4f<\/p>\n<p>gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);<\/p>\n<p>\u8a2d\u5b9a\u8996\u53e3<\/p>\n<p>gl.glViewport(0,0, GRAPHICS.GetWidth(),GRAPHICS.GetHeight());<\/p>\n<p>\u8a2d\u5b9a\u7576\u524d\u77e9\u9663\u70ba\u6295\u5f71\u77e9\u9663<\/p>\n<p>gl.glMatrixMode(GL10.GL_PROJECTION);<\/p>\n<p>\u8f09\u5165\u55ae\u4f4d\u77e9\u9663<\/p>\n<p>gl.glLoadIdentity();<\/p>\n<p>\u8a2d\u7f6e\u6295\u8996\u6295\u5f71<\/p>\n<p>GLU.gluPerspective(gl, fieldOfView, aspectRatio, near, far);<\/p>\n<p>\u8a2d\u5b9a\u7576\u524d\u77e9\u9663\u70ba\u6a21\u578b\u8996\u5716\u77e9\u9663<\/p>\n<p>gl.glMatrixMode(GL10.GL_MODELVIEW);<\/p>\n<p>\u8f09\u5165\u55ae\u4f4d\u77e9\u9663<\/p>\n<p>gl.glLoadIdentity();<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2D\u904a\u6232\u4f7f\u7528\u300e\u6b63\u4ea4\u6295\u5f71\u300f\u9019\u610f\u5473\u8457\u6a21\u578b\u8207\u8996\u9ede\u8ddd\u96e2\u7121\u8ad6\u591a\u9060,\u5176\u5c4f\u5e55\u5c3a\u5bf8\u5927\u5c0f\u7e3d\u70ba\u4e00\u81f3.\u800c3D\u904a\u6232\u5247\u4f7f\u7528\u300e\u900f\u8996\u6295\u5f71\u300f\u6a21 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.bookcard.net\/wordpress\/android_game_perspective_projection\/\" class=\"more-link\">\u7e7c\u7e8c\u95b1\u8b80 <span class=\"screen-reader-text\">Android\u904a\u6232\u4e4b\u900f\u8996\u6295\u5f71<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,62],"tags":[2,50],"class_list":["post-4466","post","type-post","status-publish","format-standard","hentry","category-android","category-opengl","tag-android","tag-opengl","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/4466","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/comments?post=4466"}],"version-history":[{"count":1,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/4466\/revisions"}],"predecessor-version":[{"id":4468,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/posts\/4466\/revisions\/4468"}],"wp:attachment":[{"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/media?parent=4466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/categories?post=4466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bookcard.net\/wordpress\/wp-json\/wp\/v2\/tags?post=4466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}