{"id":469,"date":"2014-09-05T22:16:53","date_gmt":"2014-09-05T22:16:53","guid":{"rendered":"http:\/\/blogs.discovery.wisc.edu\/projects\/?p=469"},"modified":"2014-09-05T22:16:53","modified_gmt":"2014-09-05T22:16:53","slug":"disabling-the-hsw-in-oculus-libovr-0-4-2","status":"publish","type":"post","link":"https:\/\/blogs.discovery.wisc.edu\/projects\/2014\/09\/05\/disabling-the-hsw-in-oculus-libovr-0-4-2\/","title":{"rendered":"disabling the HSW in Oculus libOVR 0.4.2"},"content":{"rendered":"<p>Oculus Rift DK2 and\u00a0SDK 0.4.2 bring some exciting improvements,\u00a0and some small problems.<\/p>\n<p>The SDK has switched to a new C API, which probably means restructuring our existing Rift code.<\/p>\n<p>It also\u00a0shows this at the start of every app:<\/p>\n<div id=\"attachment_470\" style=\"width: 1290px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/minimal-with-HSW.png\"><img aria-describedby=\"caption-attachment-470\" loading=\"lazy\" class=\"size-full wp-image-470\" src=\"http:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/minimal-with-HSW.png\" alt=\"Oculus 0.4.2 Health and Safety Warning\" width=\"1280\" height=\"801\" srcset=\"https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/minimal-with-HSW.png 1280w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/minimal-with-HSW-300x187.png 300w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/minimal-with-HSW-1024x640.png 1024w, https:\/\/blogs.discovery.wisc.edu\/projects\/files\/2014\/09\/minimal-with-HSW-479x300.png 479w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><\/a><p id=\"caption-attachment-470\" class=\"wp-caption-text\">HSW shown atop sample code from the Oculus forums.<\/p><\/div>\n<p>&#8230; which introduces something like a 4 second delay to the start of any application. \u00a0Which is a problem for a developer, who might run their app dozens or hundreds of\u00a0times in a few hours.\u00a0This is only an issue when using libOVR&#8217;s internal rendering engine (though I assume Oculus frowns on distributing software without something similar).<\/p>\n<p>It looks like at there&#8217;s some intention to allow it to be disabled at runtime, via:<\/p>\n<pre>ovrHmd_EnableHSWDisplaySDKRender( hmd, false );<\/pre>\n<p>A good candidate to be\u00a0triggered with a _DEBUG preprocessor define or something . . . but this isn&#8217;t currently exposed.<\/p>\n<p>The next easiest way seems to be toggling an a #define at line 64 of \/CAPI\/CAPI_HSWDisplay.cpp:<\/p>\n<pre>#if !defined(HSWDISPLAY_DEFAULT_ENABLED)\r\n\u00a0 \u00a0 \u00a0#define HSWDISPLAY_DEFAULT_ENABLED 0  \/\/ this used to be a 1\r\n#endif<\/pre>\n<p>&#8230; then recompiling LibOVR. \u00a0Which isn&#8217;t so bad &#8212;\u00a0VS project files are\u00a0provided, and\u00a0worked with only minor tinkering (I\u00a0had to add the DirectX SDK executables directory to the &#8220;VC++ directories&#8221; section of the project properties).<\/p>\n<p>Recompiling the SDK works for what we&#8217;re doing,\u00a0and it&#8217;s not hard, and we might need to modify libOVR eventually anyway . . . but it&#8217;s still a little silly.<\/p>\n<p>Now that libOVR is building alongside some sample code, there&#8217;s some spelunking to do through the OculusWorldDemo to find how the new API suggests we\u00a0modify eye parameters. \u00a0Digging too deeply into the new C API, it looked like there may be other new (C++?) classes inside . . . and that&#8217;s probably deeper than we&#8217;re meant to access. \u00a0Some shallower functions skimmed from\u00a0OculusWorldDemo are currently being investigated.<\/p>\n<p>(Note that this was actually tested with 0.4.1; I&#8217;ve to install the directX SDK on this other machine before testing against 0.4.2. \u00a0I&#8217;ll probably remove this note\u00a0once that&#8217;s done.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Oculus Rift DK2 and\u00a0SDK 0.4.2 bring some exciting improvements,\u00a0and some small problems. The SDK has switched to a new C API, which probably means restructuring our existing Rift code. It also\u00a0shows this at the start of every app: &#8230; which &hellip; <a href=\"https:\/\/blogs.discovery.wisc.edu\/projects\/2014\/09\/05\/disabling-the-hsw-in-oculus-libovr-0-4-2\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":89,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[32,3],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/posts\/469"}],"collection":[{"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/users\/89"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/comments?post=469"}],"version-history":[{"count":4,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/posts\/469\/revisions"}],"predecessor-version":[{"id":477,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/posts\/469\/revisions\/477"}],"wp:attachment":[{"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/media?parent=469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/categories?post=469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.discovery.wisc.edu\/projects\/wp-json\/wp\/v2\/tags?post=469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}