- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.5k
Opengl Cairo Renderer Comparison
The purpose of this page is to document differences between the Opengl and Cairo in manim to assess if we can abstract them away and make it easier to maintain them both.
Below are the similar methods that would make sense to abstract as they are called outside the renderer classes
- 
init_scenemethod to initialize the renderer
- 
playmethod to run the animation, however these have compatibility issues - see the Differences section.
- 
rendermethod to render the scene
- 
get_framemethod
- 
scene_finishedmethod after scene has completed
- 
num_playsattribute that is used a lot bySceneclass
- Each renderer has a SceneFileWriterobject that is used byScene
| Differences | Suggestions | Comments | 
|---|---|---|
| Opengl playmethod still using old style annotationshandle_caching_playandhandle_play_like_call. | Should be refactored to not rely on these annotations | |
| rendermethods not using the same parameters | Common signature that makes sense for all renderers | moving_mobjectsonly used by cairo,timeonly used by opengl | 
| Only opengl has clear_screenmethod | We could have hooks such as before_render,after_renderto make it more generic or usescene_finishedif possible | |
| Both renderers use different types of cameras | Could also create an abstract Cameraclass | |
| Only the opengl renderer has a window and interactive modes | Could move window and interactive logic inside the opengl renderer | |
| Scenereferences an attributetimeinadd_soundonly available to cairo | Add similar sound support in opengl? | See #2144 | 
In general it seems there are some common methods that would make sense create a base class that renderers must extend such as render, play, init_scene and some other hooks that are called before and after important stages such as before_render and after_render. The Scene class can then just call these in order and not be concerned about the implementation. There is also a lot of logic in the Scene class that would make more sense in the renderer such as handling the window and interactive modes, as Scene shouldn't have logic only specific to one renderer.