{"id":141,"date":"2015-10-09T03:38:43","date_gmt":"2015-10-09T03:38:43","guid":{"rendered":"http:\/\/metareal.net\/blog\/?p=141"},"modified":"2015-10-09T03:38:43","modified_gmt":"2015-10-09T03:38:43","slug":"windows-build","status":"publish","type":"post","link":"http:\/\/metareal.net\/blog\/?p=141","title":{"rendered":"Windows Build!"},"content":{"rendered":"<p><a href=\"http:\/\/metareal.net\/blog\/wp-content\/uploads\/2015\/10\/2015-10-05.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/metareal.net\/blog\/wp-content\/uploads\/2015\/10\/2015-10-05.jpg\" alt=\"2015-10-05\" width=\"500\" height=\"232\" \/><\/a><\/p>\n<p>Last week I got a used, hand-me-down Dell Optiplex 780 from a very generous friend. It&#8217;s a 2009 3ghz dual core. Upgraded it with a NVidia GT730 DDR5 graphics card ($73 amazon), and Windows 8.1. Works great! (I can run NaissancE on it, also, finally, a PC for that game.)<\/p>\n<p>Porting Metareal to it took a couple of days. Fortunately SDL2 and OpenGL are the foundations (as planned) so it mostly straightforward.<\/p>\n<p>Some notes, about porting an SDL2 and OpenGL app from Mac OS X to Windows.<\/p>\n<ul>\n<li>Be sure to add opengl32.lib to your project. Lots of web guides I read neglected this simple step!<\/li>\n<li>The base SDK only supports OpenGL 1.1. No, seriously. On Mac you just link to gl3.h and get it all, Visual Studio&#8217;s c++ SDK just has OpenGL 1.1. Turns out on Windows you need to dynamically load up all the extensions and later version&#8230;<\/li>\n<li>To get to higher versions of OpenGL, I used <a href=\"http:\/\/glew.sourceforge.net\/\">glew<\/a>. If you do, don&#8217;t get caught up in their static vs dynamic libraries and 32 vs 64 bit&#8230; just add glew.c to your project. And use their OpenGL replacement header files.<\/li>\n<li>Am I done with glew yet? No. There&#8217;s some sort of issue with <strong>glGenFrameBuffers<\/strong> and other framebuffer calls. Do <strong>glewExperimental = true; glewInit();<\/strong> and, yeah, then it works.<\/li>\n<li>SDL is a little finicky and fails silently. If you do something a little wrong, it will appear sometimes to work but\u00a0<strong>char *s = (char *)glGetString(GL_VERSION);\u00a0<\/strong>shows version 1.1.In my case, on Mac I did \u00a0<strong>SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 32);<\/strong> which, on Windows, silently throws you back to the OpenGL 1.1 software renderer. Do\u00a0<strong>SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);\u00a0<\/strong>instead.<\/li>\n<li>Another SDL2\u00a0thing&#8230; A full screen SDL2 window will steal the whole monitor&#8217;s focus even before it&#8217;s visible. Very confusing if you&#8217;re debug-stepping (and potentially forces you to reboot, if you have just one screen). Start with a non-full screen window.<\/li>\n<li>But everything ran so slowly. Shockingly slowly, absurdly slowly. Add this preprocessor directive at the project level:\u00a0<strong>_HAS_ITERATOR_DEBUGGING=0<\/strong>.<\/li>\n<li>Also set the Debug Information Format to Program Database (\/Zi), instead of the more elaborate Edit-and-continue enabled one.<\/li>\n<\/ul>\n<p>But mainly, OMG! My Windows build works!! All scripted and automated, too.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I got a used, hand-me-down Dell Optiplex 780 from a very generous friend. It&#8217;s a 2009 3ghz dual core. Upgraded it with a NVidia GT730 DDR5 graphics card ($73 amazon), and Windows 8.1. Works great! (I can run NaissancE on it, also, finally, a PC for that game.) Porting Metareal to it took [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-141","post","type-post","status-publish","format-standard","hentry","category-3"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/metareal.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/metareal.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/metareal.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/metareal.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/metareal.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=141"}],"version-history":[{"count":2,"href":"http:\/\/metareal.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/141\/revisions"}],"predecessor-version":[{"id":144,"href":"http:\/\/metareal.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/141\/revisions\/144"}],"wp:attachment":[{"href":"http:\/\/metareal.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/metareal.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=141"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/metareal.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}