-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Implement :class:~.OpenGLImageMobject
#2534
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
Conversation
make OpenGLImageMobject a subclass of OpenGLTexturedSurface
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.
I haven't reviewed the main part of the PR yet, but just some comments that jumped out at me.
for more information, see https://pre-commit.ci
Update:I managed to make moderngl textures to only take in Code:from manim import *
from manim.opengl import *
class Test(Scene):
def construct(self):
assets = Path("example_scenes", "assets")
picture = assets / "1280px-Whole_world_-_land_and_oceans"
a = OpenGLImageMobject(picture)
b = OpenGLImageMobject(np.uint8([[0, 100, 30, 200], [255, 0, 5, 33]]))
Group(a, b).arrange()
self.add(a, b) CLI: Output: |
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.
I've finally reviewed this: thank you very much, the code LGTM and I've also tested it successfully. I'll leave this open for just a little while longer in case anyone else wants to take another look.
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.
LGTM
requested changes have been carried out
OpenGLImageMobject
OpenGLImageMobject
OpenGLImageMobject
~.OpenGLImageMobject
Overview: What does this pull request change?
This PR aims to bring compatibility for
ImageMobject
to the opengl renderer. In light of issues from 3b1b's version (some warping issue, further discussed in #1837 ), this approach uses the shaders fromOpenGLTexturedSurface
.OpenGLImageMobjectTest.mp4
Numpy arrays as input
In making its cairo counterpart as equals, there exist efforts in making a numpy array as an acceptable input. Though, the output between cairo and this (opengl) is very clear, since the default sampling filter on cairo is 'bicubic' while moderngl only allows 'linear' and 'nearest' as well as some mipmap combination. Consequently, making a checkerboard pattern on an
OpenGLSurface
should be easy since all that's left is to automate the numpy array calculation to be passed to anOpenGLTexturedSurface
(left for another PR).Motivation and Explanation: Why and how do your changes improve the library?
Links to added or changed documentation pages
Further Information and Comments
Reviewer Checklist