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

Fix off-by-one bug and cleanup GL calls #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

collenjones
Copy link
Contributor

Changes:

  • Fixes off-by-one error when drawing connections between points
  • Removes GL ALPHA setup since we're not using any alpha blending
  • Extracts clear color and linewidth setting out of render loop since they don't change
  • nit: ++i instead of i++ to remove temporary variable creation

@collenjones collenjones changed the title Remove unneeded GL calls and fix bugs Fix off-by-one bug and cleanup GL calls Jul 13, 2020
Comment on lines -43 to -44
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Copy link
Contributor Author

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

Comment on lines +53 to +54
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glLineWidth(2);
Copy link
Contributor Author

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++) {
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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

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.

1 participant