Giter VIP home page Giter VIP logo

Comments (13)

LiangliangNan avatar LiangliangNan commented on June 8, 2024

Thanks for reporting the potential issue.
I don't have such a device for debugging, which makes it tricky for me.
Can you attach some snapshots?

from easy3d.

LiangliangNan avatar LiangliangNan commented on June 8, 2024

By checking your code, I found that you have changed
const auto y = height() - (i + 1) * view_height_;
to
const auto y = i * view_height_;
This seems wrong because the OpenGL tradition is to have the origin of the coordinate system at the lower left corner. But the window system (based on GLFW) has that at the top left corner.
I still believe the dpi_scaling should be applied, so I guess your change to the calculation of the Y coordinate is the source of the issue. Can you please check?

from easy3d.

r3dl3g avatar r3dl3g commented on June 8, 2024

Of course,

Without the patch:
Without the patch

With the patch:
With the patch

from easy3d.

r3dl3g avatar r3dl3g commented on June 8, 2024

By checking your code, I found that you have changed
const auto y = height() - (i + 1) * view_height_;
to
const auto y = i * view_height_;
This seems wrong because the OpenGL tradition is to have the origin of the coordinate system at the lower left corner. But the window system (based on GLFW) has that at the top left corner.

Ah, I didn't was aware of this OpenGL tradition. So sorry for this unnecessary change.

from easy3d.

r3dl3g avatar r3dl3g commented on June 8, 2024

So I changed this part back and that's the result:
Bildschirmfoto vom 2024-03-07 11-11-34

And that's the diff now:

diff --git a/easy3d/viewer/multi_viewer.cpp b/easy3d/viewer/multi_viewer.cpp
index 3116de7d..1eeb59cf 100644
--- a/easy3d/viewer/multi_viewer.cpp
+++ b/easy3d/viewer/multi_viewer.cpp
@@ -223,13 +223,15 @@ namespace easy3d {
         for (int i = 0; i < num_rows_; ++i) {
             auto &row = views_[i];
             const auto y = height() - (i + 1) * view_height_;
-            for (int j = 0; j < num_cols_; ++j)
+            for (int j = 0; j < num_cols_; ++j) {
+                const auto x = j * view_width_;
                 row[j].viewport = ivec4(
-                        static_cast<int>(static_cast<float>(j * view_width_) * dpi_scaling()),
-                        static_cast<int>(static_cast<float>(y) * dpi_scaling()),
-                        static_cast<int>(static_cast<float>(view_width_) * dpi_scaling()),
-                        static_cast<int>(static_cast<float>(view_height_) * dpi_scaling())
+                        static_cast<int>(static_cast<float>(x)),
+                        static_cast<int>(static_cast<float>(y)),
+                        static_cast<int>(static_cast<float>(view_width_)),
+                        static_cast<int>(static_cast<float>(view_height_))
                 );
+            }
         }
 
         // ------------------------------------------------------------

from easy3d.

r3dl3g avatar r3dl3g commented on June 8, 2024

Btw thanks for this wonderful piece of code.
I've been looking for a real high level 3D library for a long time, without the need for masses of glx boilerplate code and then luckily I found this one.

from easy3d.

LiangliangNan avatar LiangliangNan commented on June 8, 2024

Thanks for your kind words!
I believe the issue is in some other part(s) of the code. For now, you can use your workaround solution.
I cannot debug it because I don't have such a device, but I will check with some friends if can further investigate this issue.
Can you change, in the main.cpp file, from
initialize();
to
initialize(true);
Then you will see a log file Tutorial_205_MultiView.log will be generated next to the executable. I would be grateful if you post the entire log here, in the hope that I can find some clue about the issue.

from easy3d.

r3dl3g avatar r3dl3g commented on June 8, 2024

Of course. Here there are:

Without patch:
Tutorial_205_MultiView.log

With patch:
Tutorial_205_MultiView-with_patch.log

As far as I can see, they are identical.

from easy3d.

LiangliangNan avatar LiangliangNan commented on June 8, 2024

I don't have a Linux machine with a hidpi screen. But I've tried to fix this issue using a Mac (which has hidpi).
The new code is in the 'hidpi' branch: https://github.com/LiangliangNan/Easy3D/tree/hidpi
Can you check if it works and post a snapshot here?

from easy3d.

r3dl3g avatar r3dl3g commented on June 8, 2024

grafik

Sorry, no change on my machine with that fix.

from easy3d.

LiangliangNan avatar LiangliangNan commented on June 8, 2024

Okay. Then please go with your changes. I will have to find a proper machine to further explore the issue.

from easy3d.

r3dl3g avatar r3dl3g commented on June 8, 2024

Just for completeness, I testet now also under windows10 on the same machine and got the same results, as under linux:

Original:
MultiView_original

With Patch:
MultiView_patched

from easy3d.

r3dl3g avatar r3dl3g commented on June 8, 2024

I forgot to mention a very small change to compile it with Visual Studio 2017:

diff --git a/easy3d/util/console_style.cpp b/easy3d/util/console_style.cpp
index d2d793ee..2a5632f3 100755
--- a/easy3d/util/console_style.cpp
+++ b/easy3d/util/console_style.cpp
@@ -30,6 +30,7 @@
 #include <vector>
 #include <cstring>
 #include <cstdlib>  // for std::getenv
+#include <string>
 
 namespace easy3d
 {

But that's does not affect this issue

from easy3d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.