From 6b4137661e45f32448ca326a305e995eeae707ff Mon Sep 17 00:00:00 2001 From: Jean-Romain Date: Wed, 28 Aug 2024 03:12:10 -0400 Subject: [PATCH] Fix #23 edl alignment --- src/lidRviewer.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lidRviewer.cpp b/src/lidRviewer.cpp index d33a7f5..0953962 100644 --- a/src/lidRviewer.cpp +++ b/src/lidRviewer.cpp @@ -56,6 +56,9 @@ void sdl_loop(DataFrame df, std::string hnof) glEnable(GL_LINE_SMOOTH); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + Drawer *drawer = new Drawer(window, df, hnof); drawer->camera.setRotateSensivity(0.1); drawer->camera.setZoomSensivity(10); @@ -135,7 +138,9 @@ void sdl_loop(DataFrame df, std::string hnof) glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluPerspective(70, (double)width / height, zNear, zFar); + gluPerspective(70, (float)width / (float)height, zNear, zFar); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); drawer->camera.changed = true; } break; @@ -180,8 +185,9 @@ void sdl_loop(DataFrame df, std::string hnof) void viewer(DataFrame df, std::string hnof) { if (running) Rcpp::stop("lidRviewer is limited to one rendering point cloud"); - sdl_thread = std::thread(sdl_loop, df, hnof); - sdl_thread.detach(); // Detach the thread to allow it to run independently + sdl_loop(df, hnof); + //sdl_thread = std::thread(sdl_loop, df, hnof); + //sdl_thread.detach(); // Detach the thread to allow it to run independently running = true; }