Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified source code for added compatibility on MacOS #30

Open
wants to merge 21 commits into
base: michael
Choose a base branch
from

Conversation

michizhou
Copy link
Collaborator

Updated the source code of files involved with rendering of 3D and 2D image scans and volumes with modifications to implementation of OpenGL shaders for feature selection and replacement of shader storage buffer objects with texture buffers for compatibility on MacOS. Also changed dimensions for viewports of application menu windows (i.e. feature selection, endpoint selection, bounding polygon) for increased usability on MacOS systems. Updated CMake file to streamline initial compilation.

@michizhou michizhou requested a review from fwilliams July 17, 2019 17:35
Copy link
Owner

@fwilliams fwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that this PR is doing several things at once. The first is changes to the OpenGL rendering code and general changes to make the application compile and render on OSX. The second are changes to the viewport in the bounding_polygon_plugin.. The third is adding mouse events in the selection_plugin.

The rendering code and compiler changes look good to me. We should wrap the glDebugCallback stuff in a cleaner way so we don't have #ifdefs everywhere but this can be done when all the issues have been resolved.

For the viewport changes, I don't quite understand the problem being solved here. Could you give me a detailed explanation?

For the mouse event changes. I think it's a very nice feature to have, but I would like to limit the functionality changes per pull request. If there are too many changes in one PR, it's hard to track down bugs.

src/main.cpp Outdated
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
glDebugMessageCallback(log_opengl_debug, NULL);
#endif
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want glDebugMessageCallback on Linux too.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You moved other stuff to a helper function, let's wrap this in a helper function called init_opengl_debug() (or something more appropriate if you want). You can put the function alongside the other helper functions you wrote.

src/ui/bounding_polygon_plugin.cpp Show resolved Hide resolved
src/ui/bounding_widget_2d.cpp Outdated Show resolved Hide resolved
src/ui/endpoint_selection_plugin.cpp Outdated Show resolved Hide resolved
src/ui/selection_plugin.cpp Outdated Show resolved Hide resolved
src/ui/selection_plugin.cpp Outdated Show resolved Hide resolved
Copy link
Owner

@fwilliams fwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome that it works! There is still some small cleanup to do and we need to get the CI working, but this is almost done 💯

src/ui/bounding_polygon_plugin.cpp Outdated Show resolved Hide resolved
src/main.cpp Outdated
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
glDebugMessageCallback(log_opengl_debug, NULL);
#endif
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You moved other stuff to a helper function, let's wrap this in a helper function called init_opengl_debug() (or something more appropriate if you want). You can put the function alongside the other helper functions you wrote.

src/ui/bounding_widget_2d.h Outdated Show resolved Hide resolved
src/ui/endpoint_selection_plugin.cpp Outdated Show resolved Hide resolved
src/ui/endpoint_selection_plugin.h Outdated Show resolved Hide resolved
src/ui/state.cpp Outdated Show resolved Hide resolved
src/ui/selection_plugin.h Outdated Show resolved Hide resolved
src/ui/state.h Outdated Show resolved Hide resolved
src/utils/utils.cpp Outdated Show resolved Hide resolved
src/utils/utils.h Outdated Show resolved Hide resolved
CMakeLists.txt Outdated
@@ -125,7 +130,8 @@ list(FILTER UTILS_HEADER EXCLUDE REGEX cgal*)
add_library(utils STATIC ${UTILS_SRCS} ${UTILS_HEADER})
set_property(TARGET utils PROPERTY CXX_STANDARD 14)
set_property(TARGET utils PROPERTY CXX_STANDARD_REQUIRED ON)
target_link_libraries(utils igl::core igl::opengl igl::cgal igl::triangle spdlog Qt5::Core Qt5::Widgets spdlog)
include_directories(external/libigl/external/glfw/include)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to set this globally. The target glfw should handle setting up include paths. You can remove this line.

@@ -39,6 +39,9 @@ class Bounding_Polygon_Widget {
float split_point_size = 7.f;
float center_point_size = 12.f;
float selected_center_point_size = 14.f;
#ifdef __APPLE__
float macos_widget_scaling_factor = 4.5f; // Scaling factor for widget window range on macOS
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain why it's set to 4.5. At some point, somebody is going to read this code and have to figure out why this is the magic number that works. Explain the different conversions and what's going on. This comment should be detailed.

@@ -121,6 +129,9 @@ float FishUIViewerPlugin::hidpi_scaling() {

float xscale, yscale;
glfwGetWindowContentScale(window, &xscale, &yscale);
#ifdef __APPLE__
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing as above. Let's have a descriptive comment.

@michizhou michizhou requested a review from fwilliams July 25, 2019 19:28
Copy link
Owner

@fwilliams fwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last small changes, then let's do a run on all the platforms and we can merge

@@ -44,7 +44,8 @@ bool load_rawfile(const std::string& rawfilename, const Eigen::RowVector3i& dims

bool load_rawfile(const std::string& rawfilename, const Eigen::RowVector3i& dims, std::vector<uint8_t> &out, std::shared_ptr<spdlog::logger> logger);

void init_opengl_debug();
// void init_opengl_debug(typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam) callback);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm commented code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that. Should have known better

@@ -189,10 +189,11 @@ bool load_rawfile(const std::string& rawfilename, const Eigen::RowVector3i& dims
return true;
}

void init_opengl_debug() {
// void init_opengl_debug(void (*)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar *, const void *) callback) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm commented code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that. Should have known better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants