ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.01k stars 1.27k forks source link

Submit, Vive HMD Shuts Off, Red LED #743

Closed Karutoh closed 6 years ago

Karutoh commented 6 years ago

I know this is a problem on my side, but what does this mean? That the GL_TEXTURE_2D is invalid? I rendered everything to a single Frame Buffer Object (FBO) and submitted it to the HMD, but the HMD just shuts off and shows a red led. Do I need to do glFinish/glFlush after I finish rendering to FBO? There were also no errors.

void Window::GameLoop()
{
    //This is temporary, bad practice.
    if (vr::VR_IsHmdPresent())
    {
        if (!system)
        {
            vr::HmdError err = vr::EVRInitError::VRInitError_None;

            system = vr::VR_Init(&err, vr::EVRApplicationType::VRApplication_Scene);
            if (err)
                return;

            if (!vr::VRCompositor())
                return;

            VirtualReality::Update();
        }
    }

    Window::Update();
    Window::Render();

    //This is temporary, bad practice.
    if (vr::VR_IsHmdPresent())
    {
        glFlush();
        glFinish();
    }
}

void Test::Render()
{
    Level::Render();

    lwe::Entity *monitor = GetEntity(U"Monitor");
    if (monitor)
    {
        lwe::Screen *scr = monitor->GetComponent<lwe::Screen>(U"Screen");

        vr::Texture_t tex{
            (void *)(uintptr_t)scr->GetFboTexture()->TextureHandle(),
            vr::ETextureType::TextureType_OpenGL,
            vr::EColorSpace::ColorSpace_Auto
        };

        vr::EVRCompositorError err = vr::VRCompositor()->Submit(vr::EVREye::Eye_Left, &tex);
        if (!err) //My simple error...
            exit(1);

        err = vr::VRCompositor()->Submit(vr::EVREye::Eye_Right, &tex);
        if (!err) //My simple error...
            exit(1)
    }
}
Karutoh commented 6 years ago

Nevermind, I didn't know I had to use vr::VRCompositor()->WaitGetPoses. Also made a small mistake with error checking. On top of that, the reason why the HMD shut off is because of Nvidia's Driver Bug.

kisak-valve commented 6 years ago

Closing per the last comment.