ManimCommunity / ManimCommunity/manim

When renderer is openGL, Point has no attribute 'color'

Open
#4,175 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

## Description of bug / unexpected behavior

```
self.add(Point(location=[-1, 0, 0], color=WHITE))
```
I wrote this code and it did well before i switch the renderer to the OpenGL, but after i change i got an exeception:
```
Traceback (most recent call last):
File "E:\project_new\manim\linear-transform\main.py", line 29, in
main()
File "E:\project_new\manim\linear-transform\main.py", line 25, in main
PointMovingOnShapes().render()
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\scene\scene.py", line 237, in render
self.construct()
File "E:\project_new\manim\linear-transform\main.py", line 7, in construct
self.add(Point(location=[-1, 0, 0], color=WHITE))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\mobject\types\point_cloud_mobject.py", line 412, in __init__
super().__init__(color=color, **kwargs)
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\mobject\types\point_cloud_mobject.py", line 72, in __init__
super().__init__(**kwargs)
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\mobject\opengl\opengl_mobject.py", line 186, in __init__
self.init_points()
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\mobject\types\point_cloud_mobject.py", line 416, in init_points
self.generate_points()
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\mobject\types\point_cloud_mobject.py", line 420, in generate_points
self.add_points(np.array([self.location]))
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\mobject\types\point_cloud_mobject.py", line 99, in add_points
color = ManimColor(color) if color else self.color
^^^^^^^^^^
AttributeError: 'Point' object has no attribute 'color'
```

## Expected behavior

## How to reproduce the issue

Code for reproducing the problem

```py
self.add(Point(location=[-1, 0, 0], color=WHITE))
```

## Additional media files

Images/GIFs

## Logs
Terminal output

```
Traceback (most recent call last):
File "E:\project_new\manim\linear-transform\main.py", line 29, in
main()
File "E:\project_new\manim\linear-transform\main.py", line 25, in main
PointMovingOnShapes().render()
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\scene\scene.py", line 237, in render
self.construct()
File "E:\project_new\manim\linear-transform\main.py", line 7, in construct
self.add(Point(location=[-1, 0, 0], color=WHITE))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\mobject\types\point_cloud_mobject.py", line 412, in __init__
super().__init__(color=color, **kwargs)
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\mobject\types\point_cloud_mobject.py", line 72, in __init__
super().__init__(**kwargs)
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\mobject\opengl\opengl_mobject.py", line 186, in __init__
self.init_points()
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\mobject\types\point_cloud_mobject.py", line 416, in init_points
self.generate_points()
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\mobject\types\point_cloud_mobject.py", line 420, in generate_points
self.add_points(np.array([self.location]))
File "E:\project_new\manim\linear-transform\.venv\Lib\site-packages\manim\mobject\types\point_cloud_mobject.py", line 99, in add_points
color = ManimColor(color) if color else self.color
^^^^^^^^^^
AttributeError: 'Point' object has no attribute 'color'
```

## System specifications

System Details

- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)):
- RAM:
- Python version (`python/py/python3 --version`):
- Installed modules (provide output from `pip list`):
```
Windows 11
python 3.12.4
```

LaTeX details

+ LaTeX distribution (e.g. TeX Live 2020):
+ Installed LaTeX packages:

## Additional comments

Contributor guide

Open the contributing guide

Research direction

Start with manim/mobject/types/point_cloud_mobject.py, especially Point.__init__, init_points, generate_points, and add_points, then compare the OpenGL base path in manim/mobject/opengl/opengl_mobject.py. Reproduce the supplied Point(location=[-1, 0, 0], color=WHITE) example with the OpenGL renderer and trace when color becomes available. Done means the example no longer raises AttributeError and existing point-cloud tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.