10-28-2019 08:35 AM
ovrLayerEquirect2 layer = vrapi_DefaultLayerEquirect2();
ovrLayer_Union2 layerUnion;
for (int i = 0; i < 2; i++)
{
layer.Textures.ColorSwapChain = SwapChain;
layer.Textures.SwapChainIndex = 0;
}
layer.Header.Flags |= VRAPI_FRAME_LAYER_FLAG_INHIBIT_SRGB_FRAMEBUFFER;
layer.TexCoordsFromTanAngles = ovrMatrix4f_CreateIdentity();
// Crop the correct stereo portion and then scale and translate it to fill the screen
ovrRectf* texrect[2] = {&layer.Textures[0].TextureRect, &layer.Textures[1].TextureRect};
ovrMatrix4f* texmatrix[2] = {&layer.Textures[0].TextureMatrix,
&layer.Textures[1].TextureMatrix};
*texrect[0] = {0.0f, 0.0f, 1.0f, 0.5f};
texmatrix[0]->M[0][0] = 1.0f;
texmatrix[0]->M[0][1] = 0.0f;
texmatrix[0]->M[0][2] = 0.0f;
texmatrix[0]->M[1][0] = 0.0f;
texmatrix[0]->M[1][1] = 0.5f;
texmatrix[0]->M[1][2] = 0.0f;
*texrect[1] = {0.0f, 0.5f, 1.0f, 1.0f};
texmatrix[1]->M[0][0] = 1.0f;
texmatrix[1]->M[0][1] = 0.0f;
texmatrix[1]->M[0][2] = 0.0f;
texmatrix[1]->M[1][0] = 0.0f;
texmatrix[1]->M[1][1] = 0.5f;
texmatrix[1]->M[1][2] = 0.5f;
layerUnion.Equirect = layer;
return layerUnion;
01-28-2020 09:07 PM
01-29-2020 12:18 PM