VR headset support

  1. 2 years ago

    I have access to both Oculus and Vive headsets and thought it may be cool to add support in Polycode for both, but I am not entirely sure where I would get started.

    I am guessing it would involve creating a new Core class, and for the Vive controllers modifying PolyInputEvent?

    Any pointer in the right direction should be sufficient. Thanks!

  2. Ivan

    6 Apr 2016 Administrator

    There is some code existing already for VR rendering:


    I wrote this for Oculus DK1 and a much older version of Polycode, so it probably has to be tweaked quite a bit.

    For controller input, I would just make its own class or add to the same VR class that handles the cameras since it doesn't really fit within any existing input paradigms.

  3. last year

    I know in some threads you've talked about wanting to use native calls over umbrella libraries, such as with using SDL over regular X11 calls. Should I be approaching VR headsets the same way? OpenVR is a Valve library that is suppose to support various headsets or I can continue using Oculus' own library for the Rift.

  4. Ivan

    9 Jul 2016 Administrator

    Hey, I actually implemented OpenVR into Polycode but haven't commited it yet because I can't get the frame syncing to happen properly. It's always off by a frame or two and it's really jarring with the Vive bounds overlay because that's perfectly synced. Maybe you could help me with that?

  5. Sure I can take a look at that in the next couple of days and see what I can find.

  6. Does this mean that polycode 0.8.5 could have VR support? :)

  7. fodinabor

    15 Jul 2016 Administrator

    Should be, yes

  8. Ivan

    15 Jul 2016 Administrator
    Edited last year by Ivan

    Hey @zeebok, I am doing some more API restructuring this weekend so probably won't commit his until next week, but it's still coming! And yes, once we figure out the frame syncing, it will have VR support for all headsets that OpenVR supports.

  9. That's fine. Is there any other areas that would be good to look at into helping out with?

  10. Ivan

    29 Jul 2016 Administrator

    @zeebok I just commited the VR stuff to goodbye_cmake if you want to take a look.

    The code below illustrates how to use it:

    PolycodeTemplateApp::PolycodeTemplateApp(PolycodeView *view) {
    	core = new POLYCODE_CORE(view, 1280 , 720, false, false, 0, 0, 180, 0, false);
    	core->addFileSource("archive", "default.pak");
    	ResourcePool *globalPool = core->getResourceManager()->getGlobalPool();
    	globalPool->loadResourcesFromFolder("default", true);
    	scene = new Scene(core, Scene::SCENE_3D);
    	scene->useClearColor = true;
    	vr.initVR(core, scene);
    void PolycodeTemplateApp::handleEvent(Event *event) {
    	InputEvent *inputEvent = (InputEvent*)event;
    PolycodeTemplateApp::~PolycodeTemplateApp() {
    bool PolycodeTemplateApp::Update() {
    	bool retVal =  core->Update();
    	RenderFrame *frame = new RenderFrame(core->getViewport());
    	scene->Render(frame, NULL, NULL, NULL, false);
    	return retVal;

    vr.Render will render it into the compositor render buffers and the render in the main update loop renders it to the screen so you can debug.

  11. I haven't forgot about this! Busyness has kept my from working on it as much as I'd like but also running into linker errors when trying to compile the win32 TemplateApp. Is the latest commit of the goodbye_cmake branch in a state that won't compile?

    From a fresh install, the has a linker error about not being able to open 'portaudio.lib' and from what I can tell it is because most of the dependency libs and modules are not built in the solution. Any suggestions?

  12. fodinabor

    8 Sep 2016 Administrator

    see the changes to the project files in my (closed) PR: https://github.com/ivansafrin/Polycode/pull/695/files

    wanted to rebase this but... well I got told I should hang on a bit :) so I did not do so... so maybe there has to be done more to get everything running.. not sure atm..

  13. Great thanks! I will take a look at this and see if it does the trick after work.

  14. Edited last year by zeebok

    So that certainly removed most of the compile and linker errors but I am still getting one for ksguid.lib missing. From what I can tell it is part of the Windows SDK, or at least use to be and is no longer part of it.

    I was reading this on an issue posted for portaudio, where they say

    ksguid.lib is no longer in Platform SDK 8.0

    so I am not sure where to go from here since it seems newer versions of Visual Studio (I am on 2015) only offer Win8 and Win8 SDKs of very recent versions.

    Bleh, this is why I usually do coding on Linux :P

  15. fodinabor

    21 Sep 2016 Administrator

    this commit should fix that: https://github.com/fodinabor/Polycode/commit/4c383340bd1a2ffceb41fc59264d9397b987c20f

  16. I already have the changes to the project files from your pull request. The issue is I don't have the library, or the folder you added for it to search. The installer for VS2015 has options for Windows SDKs but they no longer provide ksguid.lib. Unless there is something additional I am suppose to install I am unaware of?

  17. fodinabor

    22 Sep 2016 Administrator

    Uhm.. Yeah.. I see - you have to install the windows 8 sdk I guess (6.3 should be win8). It should be available from microsoft download page

  18. Okay, I will take a look later today. Thanks.

  19. fodinabor

    22 Sep 2016 Administrator

    https://developer.microsoft.com/de-de/windows/downloads/windows-8-1-sdk (my failure: should be this... not plain win 8.. as: 6.0 = Vista, 6.1 = 7, 6.2 = 8, 6.3 = 8.1)

  20. The issue is that the newest version of the Windows SDK seems to have the ksguid.lib removed. Microsoft's web installer grabs the newest obviously, so I am going to have to hunt down an older full installer.

  21. Newer ›

or Sign Up to reply!