Projection offset matrices in 0.3.1 SDK
With the 0.2.x SDK I had my stereo rendering code working using the sample code from the docs to calculate the left and right projection offsets with code like this:
float viewCenter = hmd.HScreenSize * 0.25f;
float eyeProjectionShift = viewCenter - hmd.LensSeparationDistance*0.5f;
float projectionCenterOffset = 4.0f * eyeProjectionShift / hmd.HScreenSize;
// Projection matrix for the "center eye", which the left/right matrices are based on.
Matrix4f projCenter = Matrix4f::PerspectiveRH(yfov, aspect, 0.3f, 1000.0f);
Matrix4f projLeft = Matrix4f::Translation(projectionCenterOffset, 0, 0) * projCenter;
Matrix4f projRight = Matrix4f::Translation(-projectionCenterOffset, 0, 0) * projCenter;
Now I'm attempting to integrate the 0.3.1 SDK to use the SDK distortion rendering, but the examples in the docs seem to now be using the new C API and I can't figure out how to access the same information I used to get from the HMDInfo struct through this API. I see the ovrMatrix4f_Projection function being used in the new sample code but this appears to be generating the entire projection matrix, which is not really practical for me to do.
Is the old method of calculating the left and right offsets no longer applicable in the new SDK, or is it just not compatible with the C interface and/or SDK distortion rendering? Do I need to mix the two APIs to accomplish what I'm trying to do? If anyone could help clarify this for me it would be much predicated.
Thanks,
Evan
float viewCenter = hmd.HScreenSize * 0.25f;
float eyeProjectionShift = viewCenter - hmd.LensSeparationDistance*0.5f;
float projectionCenterOffset = 4.0f * eyeProjectionShift / hmd.HScreenSize;
// Projection matrix for the "center eye", which the left/right matrices are based on.
Matrix4f projCenter = Matrix4f::PerspectiveRH(yfov, aspect, 0.3f, 1000.0f);
Matrix4f projLeft = Matrix4f::Translation(projectionCenterOffset, 0, 0) * projCenter;
Matrix4f projRight = Matrix4f::Translation(-projectionCenterOffset, 0, 0) * projCenter;
Now I'm attempting to integrate the 0.3.1 SDK to use the SDK distortion rendering, but the examples in the docs seem to now be using the new C API and I can't figure out how to access the same information I used to get from the HMDInfo struct through this API. I see the ovrMatrix4f_Projection function being used in the new sample code but this appears to be generating the entire projection matrix, which is not really practical for me to do.
Is the old method of calculating the left and right offsets no longer applicable in the new SDK, or is it just not compatible with the C interface and/or SDK distortion rendering? Do I need to mix the two APIs to accomplish what I'm trying to do? If anyone could help clarify this for me it would be much predicated.
Thanks,
Evan
