-
Notifications
You must be signed in to change notification settings - Fork 51
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
Fix selection buffer crash after resizing window #446
Conversation
Codecov Report
@@ Coverage Diff @@
## ign-rendering6 #446 +/- ##
==================================================
+ Coverage 53.55% 55.53% +1.97%
==================================================
Files 195 195
Lines 19698 19697 -1
==================================================
+ Hits 10550 10938 +388
+ Misses 9148 8759 -389
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for me and fixes the crash as well as the selection offset problem. However, I'm not familiar with the code, so I'll defer the review to someone else.
Selection doesn't seem to be working for me with this branch on Bionic 😕 |
#447 switches back to the old cpu based method. We can get that in first while we debug the issue here. |
I'm testing this in a focal docker container which I was able to reproduce the issue in but the issues went away with these changes so I'll need more info to help debug this.
|
Ah sorry I merged with diff --git a/ogre2/src/Ogre2RayQuery.cc b/ogre2/src/Ogre2RayQuery.cc
index 0ceaee80..81c63178 100644
--- a/ogre2/src/Ogre2RayQuery.cc
+++ b/ogre2/src/Ogre2RayQuery.cc
@@ -98,7 +98,7 @@ RayQueryResult Ogre2RayQuery::ClosestPoint()
// ray query using selection buffer does not seem to work on some machines
// using cpu based ray-triangle intersection method
// \todo remove this line if selection buffer is working again
- return this->ClosestPointByIntersection();
+ //return this->ClosestPointByIntersection();
#ifdef __APPLE__
return this->ClosestPointByIntersection();
I don't seem to have an offset, I've clicked all over
No
No
I don't see anything added to the Ogre log while I'm hovering / clicking the scene I added these debug statements: diff --git a/ogre2/src/Ogre2SelectionBuffer.cc b/ogre2/src/Ogre2SelectionBuffer.cc
index 0082f0ad..e76730bc 100644
--- a/ogre2/src/Ogre2SelectionBuffer.cc
+++ b/ogre2/src/Ogre2SelectionBuffer.cc
@@ -495,6 +495,7 @@ bool Ogre2SelectionBuffer::ExecuteQuery(const int _x, const int _y,
const std::string &entName =
this->dataPtr->materialSwitcher->EntityName(cv);
+ignerr << "ExecuteQuery : " << entName << std::endl;
if (entName.empty())
{
return false;
@@ -507,6 +508,7 @@ bool Ogre2SelectionBuffer::ExecuteQuery(const int _x, const int _y,
return false;
else
{
+ignerr << "ExecuteQuery" << std::endl;
_item = dynamic_cast<Ogre::Item *>(collection[0]);
_point = point;
return true; And I only see empty |
Here's my ogre2.log
|
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
I think the cause of the issue is this line in ogre2.log:
I made some fixes in #450. I enabled the camera |
Signed-off-by: Ian Chen <[email protected]>
…n-rendering into fix_selection_resize
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, works for me on both BIonic and Focal, and I didn't notice anything weird in the code. It would be nice to address the comments about screenScalingFactor
before merging though.
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
…ebosim#446 - Add new param colorTexResolution to the selection buffer shader - Implement the Metal equivalent of texelFetch in the shaders Signed-off-by: Rhys Mainwaring <[email protected]>
…ebosim#446 - Add new param colorTexResolution to the selection buffer shader - Implement the Metal equivalent of texelFetch in the shaders Signed-off-by: Rhys Mainwaring <[email protected]>
#498) - Add new param colorTexResolution to the selection buffer shader - Implement the Metal equivalent of texelFetch in the shaders Signed-off-by: Rhys Mainwaring <[email protected]>
* fix selection buffer crash due to resize and incorrect selections Signed-off-by: Ian Chen <[email protected]> * test updating full selection buffer texture Signed-off-by: Ian Chen <[email protected]> * reenable visual at test Signed-off-by: Ian Chen <[email protected]> * fix codecheck Signed-off-by: Ian Chen <[email protected]> * testing rgb no depth, full buffer Signed-off-by: Ian Chen <[email protected]> * use 1x1 buffer, still no depth data Signed-off-by: Ian Chen <[email protected]> * prnt scaling factor Signed-off-by: Ian Chen <[email protected]> * disable device ratio Signed-off-by: Ian Chen <[email protected]> * reenable depth and utils test Signed-off-by: Ian Chen <[email protected]> * disable utils test, add visual at test after resize Signed-off-by: Ian Chen <[email protected]> * test texelfetch Signed-off-by: Ian Chen <[email protected]> * back to full buffer Signed-off-by: Ian Chen <[email protected]> * print ogre log Signed-off-by: Ian Chen <[email protected]> * codecheck Signed-off-by: Ian Chen <[email protected]> * fixing selection buffer mat script Signed-off-by: Ian Chen <[email protected]> * try 1x1 buffer again Signed-off-by: Ian Chen <[email protected]> * revert some test changes Signed-off-by: Ian Chen <[email protected]> * uncomment tests Signed-off-by: Ian Chen <[email protected]> * update scaling factor Signed-off-by: Ian Chen <[email protected]> * fix removing selection mat Signed-off-by: Ian Chen <[email protected]> * update screenScalingFactor Signed-off-by: Ian Chen <[email protected]> * minor tweak Signed-off-by: Ian Chen <[email protected]> Co-authored-by: Louise Poubel <[email protected]>
🦟 Bug fix
Summary
Fix crash when resizing ign-gazebo window. The problem was due to invalid camera projection matrix after a resize.
This PR makes sure all selection buffer resources are deleted and recreated after the window size is changed.
To test
launch ign gazebo and drag the corners to resize the window. The application would crash without this fix.
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge