Closed deepdarkbone closed 1 year ago
add makeCurrent();
before
auto model = picker.pick(models(), x, y);
and add doneCurrent();
after it.
I changed my code according your suggestion The function mark(model) can be called this time ,but there are new error messages
E 31/01/2023 21:04:56.895 framebuffer_object.cpp:761] GL error:
file: D:\MTRG_Software4.0\3rd_party\Easy3D-2.5.2\easy3d\renderer\framebuffer_object.cpp
line: 761
function: easy3d::FramebufferObject::is_bound
info: Invalid operation (The specified operation is not allowed in the current state)
E 31/01/2023 21:04:56.895 framebuffer_object.cpp:114] GL error:
file: D:\MTRG_Software4.0\3rd_party\Easy3D-2.5.2\easy3d\renderer\framebuffer_object.cpp
line: 114
function: easy3d::FramebufferObject::clear
info: Invalid operation (The specified operation is not allowed in the current state)
E 31/01/2023 21:04:56.895 framebuffer_object.cpp:118] GL error:
file: D:\MTRG_Software4.0\3rd_party\Easy3D-2.5.2\easy3d\renderer\framebuffer_object.cpp
line: 118
function: easy3d::FramebufferObject::clear
info: Invalid operation (The specified operation is not allowed in the current state)
E 31/01/2023 21:04:56.895 framebuffer_object.cpp:128] GL error:
file: D:\MTRG_Software4.0\3rd_party\Easy3D-2.5.2\easy3d\renderer\framebuffer_object.cpp
line: 128
function: easy3d::FramebufferObject::clear
info: Invalid operation (The specified operation is not allowed in the current state)
E 31/01/2023 21:04:56.895 framebuffer_object.cpp:133] GL error:
file: D:\MTRG_Software4.0\3rd_party\Easy3D-2.5.2\easy3d\renderer\framebuffer_object.cpp
line: 133
function: easy3d::FramebufferObject::clear
info: Invalid operation (The specified operation is not allowed in the current state)
E 31/01/2023 21:04:56.895 framebuffer_object.cpp:137] GL error:
file: D:\MTRG_Software4.0\3rd_party\Easy3D-2.5.2\easy3d\renderer\framebuffer_object.cpp
line: 137
function: easy3d::FramebufferObject::clear
info: Invalid operation (The specified operation is not allowed in the current state)
The picker works as followed, but error exists as i have mentioned before,
I have no idea whether it will affect other parts.
The reason is that an OpenGL function is called (in the destructor of the ModelPicker) when the OpenGL context is not made current.
Here is the solution: make ModelPicker a member variable (by something like m_picker = new ModelPicker(camera())
), and delete the picker in the destructor of the viewer.
The picker is working correctly now, thanks a lot for your help! Easy3d is really helpful for my work.
Meanwhile I have another question. In Tutorial_401_ModelPicker, mouse_press_event is overrided, but it seems that the former mouse_press_event is still working. When I override the mouse_press_event in qtviewer like Tutorial, the former event stops working, and I can't drag the model to rotate it.
Oh sorry, I find when i add
pressed_button_ = e->button();
The problem is solved.
Glad to hear that. Good luck with your research!
Hello! Thank you for your work. Based on Tutorial_204_Viewer_Qt I have built and run the qt_viewer successfully. I am trying to follow Tutorial_401_ModelPicker and use ModelPicker in overrided mousePressEvent in the qtviewer,but an error occurred
I see the following error messages while picking a model
My code is as following, MyViewer Inherits form Viewer in Tutorial_204_Viewer
I find the error occurs in drawable_points when i debug, and I notice that some have reported the bug in drawable used in qtviewer.
drawable->draw(camera())
I wonder how to solve the problem and use ModelPicker in qtviewer successfully.Development/Running environment: