From cc30f56a127db53769ae95acb4212f3ba74538bb Mon Sep 17 00:00:00 2001 From: Ivan Date: Fri, 15 Apr 2022 15:17:15 +0300 Subject: [PATCH] v3 --- src/vio.cpp | 63 ++++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/src/vio.cpp b/src/vio.cpp index 7feecac..e66c258 100644 --- a/src/vio.cpp +++ b/src/vio.cpp @@ -861,7 +861,38 @@ int main(int argc, char** argv) { // DrawImageTexture takes also the depth buffer when uploading, so we need clean it. glClear(GL_DEPTH_BUFFER_BIT); + // TODO: Can I define it outside of the loop? There's no need I guess to + // redefine the the projection matrix every time + glMatrixMode(GL_PROJECTION); + P.Load(); + // drawLinesCube pushes the matrices, therefore, I need to define in which + // stack to push that matrices. + glMatrixMode(GL_MODELVIEW); + // ar_3d_camera.Follow((T_w_i * T_i_c).matrix()); + + glPushMatrix(); + if (zeroOut){ + xSkew = 0; + ySkew = 0; + zSkew = 0; + } + if (drawCubeBool){ + DrawCube(cubeSize, xSkew, ySkew, zSkew); + } + if (drawLineCubeBool){ + drawLinesCube(xSkew, ySkew, zSkew, cubeSize); + } + // For the 6th sequence mono-kitti + if (showCube1) {drawLinesCube(-5.5, 0.5, -35.0, cubeSize);} + if (showCube2) {drawLinesCube(5.5, 0.5, -40.0, cubeSize);} + if (showCube3) {drawLinesCube(-5.5, 1.0, -95.0, cubeSize);} + if (showCube4) {drawLinesCube(5.5, 1.0, -150.0, cubeSize);} + if (showCube5) {drawLinesCube(16.0, 4.8, -324.5, cubeSize);} + if (showCube6) {drawLinesCube(32.8, 4.8, -324.5, cubeSize);} + if (showCube7) {drawLinesCube(32.5, 4.8, -345.7, cubeSize);} + + glPopMatrix(); // Ok, so here by the moment we are watching from the camera position and orientation. // Drawing the cube from here might result in drawing the cube in the camera coordinate system. // Although! We want to draw the cube from the world coordinate system, therefore @@ -1283,38 +1314,6 @@ void draw_scene_no_camera(pangolin::View& view) { // } // } - // TODO: Can I define it outside of the loop? There's no need I guess to - // redefine the the projection matrix every time - glMatrixMode(GL_PROJECTION); - P.Load(); - - // drawLinesCube pushes the matrices, therefore, I need to define in which - // stack to push that matrices. - glMatrixMode(GL_MODELVIEW); - // ar_3d_camera.Follow((T_w_i * T_i_c).matrix()); - - glPushMatrix(); - if (zeroOut){ - xSkew = 0; - ySkew = 0; - zSkew = 0; - } - if (drawCubeBool){ - DrawCube(cubeSize, xSkew, ySkew, zSkew); - } - if (drawLineCubeBool){ - drawLinesCube(xSkew, ySkew, zSkew, cubeSize); - } - // For the 6th sequence mono-kitti - if (showCube1) {drawLinesCube(-5.5, 0.5, -35.0, cubeSize);} - if (showCube2) {drawLinesCube(5.5, 0.5, -40.0, cubeSize);} - if (showCube3) {drawLinesCube(-5.5, 1.0, -95.0, cubeSize);} - if (showCube4) {drawLinesCube(5.5, 1.0, -150.0, cubeSize);} - if (showCube5) {drawLinesCube(16.0, 4.8, -324.5, cubeSize);} - if (showCube6) {drawLinesCube(32.8, 4.8, -324.5, cubeSize);} - if (showCube7) {drawLinesCube(32.5, 4.8, -345.7, cubeSize);} - - glPopMatrix(); // For the 1st sequence mono-kitti // drawLinesCube(0.0, 1.0, -95.0, cubeSize);