ValveSoftware / openvr

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

Dashboard Overlay always greyed out #385

Open martinken opened 7 years ago

martinken commented 7 years ago

Having an odd issue; I create a Dashboard Overlay. When the system menu is pressed I can select the overlay from the bubble/tab, but when the overlay renders it is greyed out (like how OpenVR greys out the rest of the 3D scene I am rendering). I can see the overylay and the image looks fine other than it is greyed out when it should be normal. Any ideas? The overlay creation is adapted from the Qt example ala

  std::string sKey = std::string( "VTK OpenVR Settings");
  vr::VROverlayError overlayError =
    vr::VROverlay()->CreateDashboardOverlay(
      sKey.c_str(), "VTK",
      &this->OverlayHandle, &this->OverlayThumbnailHandle );
  if (overlayError != vr::VROverlayError_None)
  {
    vtkErrorMacro("Error creating overlay");
    return;
  }
  vr::VROverlay()->SetOverlayWidthInMeters( this->OverlayHandle, 2.0f );
  vr::VROverlay()->SetOverlayInputMethod( this->OverlayHandle, vr::VROverlayInputMethod_Mouse );

drawing the overlay is via

  this->MakeCurrent();
  this->OverlayTexture->Bind();
  GLuint unTexture = this->OverlayTexture->GetHandle();
  if( unTexture != 0 )
  {
    vr::Texture_t texture = {(void*)(uintptr_t)unTexture, vr::TextureType_OpenGL, vr::ColorSpace_Auto };
    vr::VROverlay()->SetOverlayTexture( this->OverlayHandle, &texture );
  }
  this->OverlayTexture->UnBind();
martinken commented 7 years ago

Well for me, it seems that if you have a scene application (as opposed to an overlay application like the example) then you need to specify some overlay flags to get the overlay to render correctly. Specifically for me I set

  vr::VROverlay()->SetOverlayFlag(this->OverlayHandle, vr::VROverlayFlags_SortWithNonSceneOverlays, true);
  vr::VROverlay()->SetOverlayFlag(this->OverlayHandle, vr::VROverlayFlags_VisibleInDashboard, true);