Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
5023acc1
Commit
5023acc1
authored
Jul 07, 2022
by
Robin Eschbach
Browse files
[FIX
#733
] Vr module crash on initialization
parent
89539b94
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
14 deletions
+32
-14
src/modules/openVRCamera/WMVRCamera.cpp
src/modules/openVRCamera/WMVRCamera.cpp
+30
-13
src/modules/openVRCamera/WMVRCamera.h
src/modules/openVRCamera/WMVRCamera.h
+1
-0
src/modules/openVRCamera/WSwapUpdateCallback.cpp
src/modules/openVRCamera/WSwapUpdateCallback.cpp
+1
-1
No files found.
src/modules/openVRCamera/WMVRCamera.cpp
View file @
5023acc1
...
...
@@ -75,10 +75,11 @@ void WMVRCamera::properties()
{
m_propCondition
=
std
::
shared_ptr
<
WCondition
>
(
new
WCondition
()
);
m_vrOn
=
m_properties
->
addProperty
(
"Submit Frames"
,
"Toggle submitting frames to OpenVR"
,
false
);
m_VR_fpsTrigger
=
m_properties
->
addProperty
(
"Log Fps"
,
"Now"
,
WPVBaseTypes
::
PV_TRIGGER_READY
);
m_VR_logCameraViewMatrix
=
m_properties
->
addProperty
(
"Log Camera View Matrix"
,
"Now"
,
WPVBaseTypes
::
PV_TRIGGER_READY
);
m_VR_resetHMDPosition
=
m_properties
->
addProperty
(
"Reset position"
,
"Reset"
,
WPVBaseTypes
::
PV_TRIGGER_READY
);
m_vrOn
=
m_properties
->
addProperty
(
"Submit Frames"
,
"Toggle submitting frames to OpenVR"
,
false
,
true
);
m_VR_fpsTrigger
=
m_properties
->
addProperty
(
"Log Fps"
,
"Now"
,
WPVBaseTypes
::
PV_TRIGGER_READY
,
true
);
m_VR_logCameraViewMatrix
=
m_properties
->
addProperty
(
"Log Camera View Matrix"
,
"Now"
,
WPVBaseTypes
::
PV_TRIGGER_READY
,
true
);
m_VR_resetHMDPosition
=
m_properties
->
addProperty
(
"Reset position"
,
"Reset"
,
WPVBaseTypes
::
PV_TRIGGER_READY
,
true
);
m_VR_reinit
=
m_properties
->
addProperty
(
"Re-initialize VR-System"
,
"Init"
,
WPVBaseTypes
::
PV_TRIGGER_READY
);
WModule
::
properties
();
}
...
...
@@ -148,19 +149,36 @@ void WMVRCamera::moduleMain()
// HMD Setup
/////////////////////////////////////////////////////////////////////////////////////////////////////////
if
(
setupVRInterface
()
)
{
debugLog
()
<<
"OpenVR initialized successfully"
;
m_vrIsInitialized
=
true
;
}
else
ready
();
while
(
!
setupVRInterface
()
)
{
if
(
m_shutdownFlag
()
)
{
return
;
}
errorLog
()
<<
"OpenVR failed to initialize"
;
m_vrRenderWidth
=
1736
;
m_vrRenderHeight
=
1928
;
m_vrIsInitialized
=
false
;
while
(
m_VR_reinit
->
get
(
false
)
!=
WPVBaseTypes
::
PV_TRIGGER_TRIGGERED
)
{
if
(
m_shutdownFlag
()
)
{
return
;
}
}
m_VR_reinit
->
set
(
WPVBaseTypes
::
PV_TRIGGER_READY
,
false
);
}
m_VR_reinit
->
setHidden
(
true
);
m_vrOn
->
setHidden
(
false
);
m_VR_fpsTrigger
->
setHidden
(
false
);
m_VR_logCameraViewMatrix
->
setHidden
(
false
);
m_VR_resetHMDPosition
->
setHidden
(
false
);
debugLog
()
<<
"OpenVR initialized successfully"
;
m_vrIsInitialized
=
true
;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Render to Texture Setup
/////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -197,7 +215,6 @@ void WMVRCamera::moduleMain()
ResetHMDPosition
();
// Now, we can mark the module ready.
ready
();
debugLog
()
<<
"Starting..."
;
// loop until the module container requests the module to quit
...
...
src/modules/openVRCamera/WMVRCamera.h
View file @
5023acc1
...
...
@@ -214,6 +214,7 @@ private:
WPropTrigger
m_VR_fpsTrigger
;
//!< A trigger for debugging the FPS while VR module is running.
WPropTrigger
m_VR_logCameraViewMatrix
;
//!< A trigger for debugging camera matrix of VR module.
WPropTrigger
m_VR_resetHMDPosition
;
//!< A trigger for resetting the camera to the seated zero position of the HMD device.
WPropTrigger
m_VR_reinit
;
//!< A trigger to reinit the module if no headset was found.
vr
::
IVRSystem
*
m_vrSystem
;
//!< The OpenVR SDK Interface.
vr
::
IVRRenderModels
*
m_vrRenderModels
;
//!< The OpenVR RenderModel Interface.
...
...
src/modules/openVRCamera/WSwapUpdateCallback.cpp
View file @
5023acc1
...
...
@@ -119,7 +119,7 @@ void WSwapUpdateCallback::submitFrame()
if
(
lError
!=
vr
::
VRCompositorError_None
||
rError
!=
vr
::
VRCompositorError_None
)
{
m_module
->
errorLog
()
<<
"L
inks
:"
<<
lError
<<
"
|Rec
ht
s
:"
<<
rError
<<
std
::
endl
;
m_module
->
errorLog
()
<<
"L
eft
:"
<<
lError
<<
"
| Rig
ht:"
<<
rError
<<
std
::
endl
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment