-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Port Graph to OpenGL #1202
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
Port Graph to OpenGL #1202
Conversation
🎉 Great news! Looks like all the dependencies have been resolved: 💡 To add or remove a dependency please update this issue/PR description. Brought to you by Dependent Issues (:robot: ). Happy coding! |
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.
So far this looks good. config.renderer == "opengl"
is more recent/not deprecated, so just minor issues. I'm still looking through the three largest files (opengl_graph.py, opengl_tex_mobject.py, and opengl_text_mobject.py). More on those files later, but I have to run for now.
# Note, this potentially changes the structure | ||
# of both mobject and target_mobject | ||
self.mobject.align_data(self.target_copy) | ||
if config["use_opengl_renderer"]: |
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.
if config["use_opengl_renderer"]: | |
if config.renderer == "opengl": |
|
||
def __repr__(self): | ||
return str(self.name) | ||
if config["use_opengl_renderer"]: |
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.
if config["use_opengl_renderer"]: | |
if config.renderer == "opengl": |
This angle will always be btw 0 and pi | ||
""" | ||
return np.arccos(fdiv(np.dot(v1, v2), get_norm(v1) * get_norm(v2))) | ||
if config["use_opengl_renderer"]: |
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.
if config["use_opengl_renderer"]: | |
if config.renderer == "opengl": |
|
||
|
||
class OpenGLLabeledDot(OpenGLDot): | ||
"""A :class:`Dot` containing a label in its center. |
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.
"""A :class:`Dot` containing a label in its center. | |
"""A :class:`~.OpenGLDot` containing a label in its center. |
for command, coord_string in pairs: | ||
self.handle_command(command, coord_string, prev_command) | ||
prev_command = command | ||
if config["use_opengl_renderer"]: |
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.
if config["use_opengl_renderer"]: | |
if config.renderer == "opengl": |
return | ||
|
||
elif command == "S": # Smooth cubic | ||
if config["use_opengl_renderer"]: |
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.
if config["use_opengl_renderer"]: | |
if config.renderer == "opengl": |
|
||
elif command == "Z": # closepath | ||
self.add_line_to(self.current_path_start) | ||
if config["use_opengl_renderer"]: |
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.
if config["use_opengl_renderer"]: | |
if config.renderer == "opengl": |
height=self.attribute_to_float(rect_element.getAttribute("height")), | ||
**parsed_style, | ||
) | ||
if config["use_opengl_renderer"]: |
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.
if config["use_opengl_renderer"]: | |
if config.renderer == "opengl": |
self.handle_transforms(element, VGroup(*result)) | ||
if len(result) > 1 and not self.unpack_groups: | ||
result = [VGroup(*result)] | ||
if config["use_opengl_renderer"]: |
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.
if config["use_opengl_renderer"]: | |
if config.renderer == "opengl": |
|
||
result = [m for m in result if m is not None] | ||
self.handle_transforms(element, VGroup(*result)) | ||
if config["use_opengl_renderer"]: |
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.
if config["use_opengl_renderer"]: | |
if config.renderer == "opengl": |
The actual diff for this PR should be much smaller (and as soon as the merge conflict is resolved it should show in the GH interface), given that the #1200 has already been merged. I've diffed Given that I don't have a lot of time in the coming days, I fear that #1272 won't be finalized/merged too soon -- so in principle I'd be fine with merging this PR and adding |
@eulertour Since that's the case, I'll wait until the merge-conflicts are handled before finishing my review. Just request a review or ping me on Discord and I'll get to it ASAP. |
I'd prefer to make |
Closing this, as #1512 has been merged. |
Changelog / Overview
Port Graph to OpenGL
Depends on #1200
Motivation
Allows using Graph in OpenGL
Explanation for Changes
Ports LabeledDot and Graph to OpenGL
Testing Status
None, though I'd be willing to add some if I can find how to create OpenGL test data.
Further Comments
Checklist
Reviewer Checklist