{"id":87,"date":"2014-02-04T17:39:32","date_gmt":"2014-02-04T17:39:32","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=87"},"modified":"2015-07-19T08:20:51","modified_gmt":"2015-07-19T15:20:51","slug":"android-hello-gl2","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/android\/hello-gl2\/","title":{"rendered":"Debugging the hello-gl2 project with Visual Studio"},"content":{"rendered":"<p>This quickstart guide shows how to build and debug a simple Android App with a native library.<\/p>\n<p>Before you begin, please install <a href=\"\/download\"> VisualGDB 2.0<\/a> or later (ensure that &#8220;Android Edition&#8221; is checked in the installer). If you are not familiar with VisualGDB, please first go through the <a href=\"\/tutorials\/android\">Android Quickstart tutorial<\/a>.<\/p>\n<p><span class=\"warning\">\u00a0Warning! The Android Emulator does<br \/>\nnot support OpenGL. You will need a real device for this<br \/>\ntutorial.<\/span><\/p>\n<ol>\n<li>Start Visual Studio. Select File-&gt;New project-&gt;VisualGDB-&gt;Android Project Wizard.<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/01-newproject.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/01-newproject.png\" alt=\"01-newproject\" width=\"700\" height=\"394\" \/><\/a><\/li>\n<li>Select the directory for the project, enter a project name (e.g. <strong>GL2Wrapper<\/strong>) and press OK.<\/li>\n<li>Select &#8220;Clone a sample from NDK&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/02-clone.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/02-clone.png\" alt=\"02-clone\" width=\"700\" height=\"616\" \/><\/a><\/li>\n<li>Select the <strong>hello-gl2<\/strong> project from the list:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/03-gl2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/03-gl2.png\" alt=\"03-gl2\" width=\"700\" height=\"543\" \/><\/a><\/li>\n<li>Select a platform for the newly created project (in this example we select Android 2.3.3):<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/04-platform.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/04-platform.png\" alt=\"04-platform\" width=\"700\" height=\"543\" \/><\/a><\/li>\n<li>When done, press the <strong>Finish<\/strong> button. A new Visual Studio project will be created. Select Build-&gt;Build Solution to build the project:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/05-project.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/05-project.png\" alt=\"05-project\" width=\"681\" height=\"621\" \/><\/a><\/li>\n<li>Plug in your Android Device. <strong>Do not use the Android emulator as it does not support OpenGL.<\/strong> Enable USB debugging and install the USB driver if needed. See <a href=\"http:\/\/visualgdb.com\/tutorials\/android\/hello-gl2\/..\/usbdebug\">this guide <\/a>for more details.<\/li>\n<li>Put a breakpoint on the line containing the <strong> glClearColor()<\/strong> call inside the <strong> renderFrame()<\/strong> function.<\/li>\n<li>Start debugging by selecting Debug -&gt; Start Debugging with GDB in VIsual Studio.<\/li>\n<li>The app will be automatically deployed and launched and the breakpoint will be hit:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/07-bkpt.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/07-bkpt.png\" alt=\"07-bkpt\" width=\"681\" height=\"621\" \/><\/a><\/li>\n<li>Hover the mouse over the <strong>glTriangleVertices<\/strong> definition above renderFrame(). Then click on the &#8220;+&#8221; symbol. Finally, click on the &#8220;0.5&#8221; value so that Visual Studio starts editing it.<\/li>\n<li>Replace &#8220;0.5&#8221; with &#8220;1&#8221; and press Enter:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/08-change.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/08-change.png\" alt=\"08-change\" width=\"681\" height=\"621\" \/><\/a><\/li>\n<li>Remove the breakpoint and press F5 to continue running the App.<\/li>\n<li>Observe that the triangle shape has changed after we have modified <strong>glTriangleVertices<\/strong>:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/09-triangles.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/android\/hello-gl2\/09-triangles.png\" alt=\"09-triangles\" width=\"636\" height=\"533\" \/><\/a><\/li>\n<li>When done, press Shift+F5 to stop the debugging session.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This quickstart guide shows how to build and debug a simple Android App with a native library. Before you begin,<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[87],"tags":[31,45],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/87"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=87"}],"version-history":[{"count":1,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/87\/revisions"}],"predecessor-version":[{"id":177,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/87\/revisions\/177"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}