# Can't animate WEBGL model in draw loop

**URL:** <https://discourse.processing.org/t/cant-animate-webgl-model-in-draw-loop/29539>\
**Category:** Coding Questions\
**Created:** [April 21, 2021, 10:24am UTC](https://discourse.processing.org/t/cant-animate-webgl-model-in-draw-loop/29539 "2021-04-21T10:24:20Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [May 28, 2024, 10:25pm UTC](https://discourse.processing.org/t/cant-animate-webgl-model-in-draw-loop/29539/7 "2024-05-28T22:25:57Z")

</div>

Hello @Zuheng ,

There was a reference to _dirtyFlags_ in this topic as a solution.

A bit of searching led me to this:  
_[p5Shader - Is there a way to specify custom attributes? · Issue #5120 · processing/p5.js · GitHub](https://github.com/processing/p5.js/issues/5120#issuecomment-863749210)_

Take a look at example in _live version_ in above link for a solution.

A snippet from the _live version_:

```auto
  {
    m.dirtyFlags.vertices = true;
    m.dirtyFlags.vertexColors = true;
    
    /* Mini dirty hack (2a)
       Propogate "dirty" state to default stroke shader
    */
    // Recalculate lines (when change vertices)
    m._makeTriangleEdges()._edgesToVertices();
    m.dirtyFlags.lineVertices = true;
    m.dirtyFlags.lineNormals = true;
  }

```

Experiment a little… you may not need all of the lines in snippet.

This worked for me in a similar example.

If you follow the link by @micuat in this topic there is also a _hack_ (as they call it):

> [@Help with 3d object transfiguration/distortion effect](https://discourse.processing.org/t/help-with-3d-object-transfiguration-distortion-effect/28795/3):
>
> i think we found another hack

`:)`

---

_[View the full topic](https://discourse.processing.org/t/cant-animate-webgl-model-in-draw-loop/29539)._
