OVR: Show mirror of single eye only
[mercenary-reloaded.git] / src / libovr / ovr.c
index df019f8..8a9007f 100755 (executable)
@@ -209,10 +209,11 @@ int init_ovr(int _multisampling)
        ovrMirrorTextureDesc desc;
        memset(&desc, 0, sizeof(desc));
        desc.Width = mirror_width = TextureSize[0].w;
-       desc.Height = mirror_height = TextureSize[0].h / 2;
+       desc.Height = mirror_height = TextureSize[0].h;
        desc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB;
        desc.MirrorOptions =
-               ovrMirrorOption_PostDistortion |
+//             ovrMirrorOption_PostDistortion |
+               ovrMirrorOption_LeftEyeOnly |
                ovrMirrorOption_IncludeGuardian |
                ovrMirrorOption_IncludeNotifications |
                ovrMirrorOption_IncludeSystemGui;
@@ -418,22 +419,22 @@ void end_render_ovr(void)
 void render_mirror_ovr(int view_width, int view_height)
 {
        int view_x = 0, view_y = 0;
-       int new_width, new_height;
+       int new_height; //, new_width;
 
        /* avoid division by zero, if one dimension is too small */
        if (view_width < 1 || view_height < 1)
                return;
 
        /* calculate a viewport that has apect of TextureSize */
-       if (view_height * mirror_width > view_width * mirror_height) {
+//     if (view_height * mirror_width > view_width * mirror_height) {
                new_height = view_width * mirror_height / mirror_width;
                view_y = view_y + view_height / 2 - new_height / 2;
                view_height = new_height;
-       } else if (view_height * mirror_width < view_width * mirror_height) {
-               new_width = view_height * mirror_width / mirror_height;
-               view_x = view_x + view_width / 2 - new_width / 2;
-               view_width = new_width;
-       }
+//     } else if (view_height * mirror_width < view_width * mirror_height) {
+//             new_width = view_height * mirror_width / mirror_height;
+//             view_x = view_x + view_width / 2 - new_width / 2;
+//             view_width = new_width;
+//     }
 
        /* avoid views that are too small */
        if (view_width < 1 || view_height < 1)
@@ -449,7 +450,7 @@ void render_mirror_ovr(int view_width, int view_height)
        glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
        glBlitFramebuffer(0, mirror_height, mirror_width, 0,
                view_x, view_y, view_x + view_width, view_y + view_height,
-               GL_COLOR_BUFFER_BIT, GL_NEAREST);
+               GL_COLOR_BUFFER_BIT, GL_LINEAR);
        glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
 }