void OpenVRDevice::configure_view(StereoView &view) const
{
vr::IVRSystem *vr_sys = vr::VRSystem();
+
+#if defined(__GNUC__) && defined(_WIN32)
+ /* Visual C++ passes the return value address as first stack parameter and
+ the this pointer in ecx. MinGW does the other way around. This trick
+ forces the function signature to match at machine code level. */
+ typedef void (vr::IVRSystem::*FuncPtr)(vr::HmdMatrix34_t *, vr::EVREye);
+ FuncPtr get_eye_to_head_transform = reinterpret_cast<FuncPtr>(&vr::IVRSystem::GetEyeToHeadTransform);
+
+ vr::HmdMatrix34_t left, right;
+ (vr_sys->*get_eye_to_head_transform)(&left, vr::Eye_Left);
+ (vr_sys->*get_eye_to_head_transform)(&right, vr::Eye_Right);
+#else
vr::HmdMatrix34_t left = vr_sys->GetEyeToHeadTransform(vr::Eye_Left);
vr::HmdMatrix34_t right = vr_sys->GetEyeToHeadTransform(vr::Eye_Right);
+#endif
+
view.set_eye_matrices(convert_matrix(left), convert_matrix(right));
}