OVR: Show mirror of single eye only
authorAndreas Eversberg <jolly@eversberg.eu>
Sun, 26 May 2019 07:37:22 +0000 (09:37 +0200)
committerAndreas Eversberg <jolly@eversberg.eu>
Sun, 26 May 2019 08:49:15 +0000 (10:49 +0200)
src/libovr/ovr.c
src/mercenary/main.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);
 }
 
index 8b66015..45d87e4 100644 (file)
@@ -114,13 +114,8 @@ static uint8_t *info_osd = NULL;
 static int help_view = 1;
 static int help_views = 0;
 static int32_t osd_timer = 0, border_timer = 0;
-#ifdef HAVE_OVR
-#define SCREEN_WIDTH   1344
-#define SCREEN_HEIGHT  800
-#else
 #define SCREEN_WIDTH   (320*3)
 #define SCREEN_HEIGHT  (200*3)
-#endif
 #define IMAGE_WIDTH    320
 #define IMAGE_HEIGHT   200
 #define BENSON_AT_LINE 136