-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add pybullet.addUserDebugPoints #3996
Add pybullet.addUserDebugPoints #3996
Conversation
267b24e
to
e7460f1
Compare
@@ -1926,6 +1936,7 @@ void GLInstancingRenderer::drawPoints(const float* positions, const float color[ | |||
break; | |||
} | |||
} |
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.
Can anyone help to add colors to this efficient batch rendering of the points?
At the moment, it uses glUniform4f
to change color of points, which makes hard to have different color for each point.
(so current implementation draw each point one-by-one with changing color by glUniform4f
, which is slow)
#if 1 | ||
// FIXME: this is slow. cannot draw with color efficiently | ||
for (int i = 0; i < numPoints; i++) { | ||
glUniform4f(lines_colour, colors[4 * i + 0], colors[4 * i + 1], colors[4 * i + 2], colors[4 * i + 3]); |
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.
glUniform4f
for changing the color of the point.
glBufferSubData(GL_ARRAY_BUFFER, 0, pointStrideInBytes, positions + i * (pointStrideInBytes / sizeof(float))); | ||
glEnableVertexAttribArray(0); | ||
glVertexAttribPointer(0, pointStrideInBytes / sizeof(float), GL_FLOAT, GL_FALSE, pointStrideInBytes, 0); | ||
glDrawArrays(GL_POINTS, 0, 1); |
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.
That's why points are drawn one-by-one, which is slow.
8fc3c18
to
9e73df2
Compare
Managed the efficient colored points rendering. 2021-10-16_14-43-30.mp4 |
9e73df2
to
8662219
Compare
8662219
to
00dcce8
Compare
Very nice, thanks for the contribution. I will check it, make sure it still works on various platforms. Some minor suggestions: Please add fields in 'examples/SharedMemory/SharedMemoryCommands.h' at the end of a structure, to avoid crashes when using different versions. In particular, UserDebugDrawArgs, add m_debugPointNum and m_pointSize as last new members, not in the middle of the struct. Change comment from
to
|
Thanks for the fixes! One last request, do you have a simple example python script how to use it? You could reply with a zipped attachment (zip files work, other extension often don't). |
Does this work for you? my_example.zip
|
Thanks for the example. Close/re-open to re-trigger CI. |
LGTM, let's merge the PR. Thanks for the contribution! |
Great! 👍 |
fix for debug lines / point rendering, introduced in PR #3996
A minor note: to improve file loading in PyBullet, disable rendering before, and re-enable rendering after loading:
|
Yup |
2021-10-14_20-24-42.mp4
2021-10-14_20-25-12.mp4