Can't animate WEBGL model in draw loop

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

Take a look at example in live version in above link for a solution.

A snippet from the live version:

  {
    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):

:)

1 Like