-
Notifications
You must be signed in to change notification settings - Fork 2k
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 off-by-one bug and cleanup GL calls #113
base: master
Are you sure you want to change the base?
Conversation
glEnable(GL_BLEND); | ||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
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.
We do not need alpha blending in this example
glClearColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
glLineWidth(2); |
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.
These do not change so we don't need to reset them every loop iteration
@@ -76,7 +74,7 @@ void DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator<Isometry3d>> pos | |||
glEnd(); | |||
} | |||
// 画出连线 | |||
for (size_t i = 0; i < poses.size(); i++) { |
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.
Off by one error here since we're drawing a line from i -> i + 1
glClearColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
glLineWidth(2); | ||
for (size_t i = 0; i < poses.size(); i++) { | ||
for (size_t i = 0; i < poses.size(); ++i) { |
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.
nit: ++i is more efficient
Changes:
++i
instead ofi++
to remove temporary variable creation