`update` is in charge of updating the data used in OpenGL calls during drawing, there might be many use cases depending on the primitive, but a common one would be updating the drawable points according to primitive's `transform` (i.e. `CurvePrim`). Notice h
(self)
| 206 | # === To be extended by subclasses === |
| 207 | |
| 208 | def update(self): |
| 209 | """ |
| 210 | `update` is in charge of updating the data used in OpenGL calls during |
| 211 | drawing, there might be many use cases depending on the primitive, but |
| 212 | a common one would be updating the drawable points according to |
| 213 | primitive's `transform` (i.e. `CurvePrim`). |
| 214 | |
| 215 | Notice how this method sets `isDirty` flag to False at the end, this |
| 216 | is VERY IMPORTANT, otherwise your primitive will be updated each time |
| 217 | the viewport gets refreshed (even when the data doesn't change). |
| 218 | """ |
| 219 | logger.debug('Updating: {}'.format(self)) |
| 220 | self.isDirty = False |
| 221 | |
| 222 | def draw(self, view, renderer): |
| 223 | """ |