js gets slower and slower

audiovisualist's icon

hi,
i have a js that creates one render object and sketch object with drawing some triangles in opengl. these are scaling up and down over the time. at startup everything works fine but after some minutes the fps going down and down from 50 to 30 and less. the render gets banged after the drawing command. have anybody a suggestion where the problem is? can it be a memory leg, because calculate the new vertex position is done each time the drawing command is called which is metro 50.

thanks

Peter Castine's icon

Make sure you send your gl.sketch object reset and flush messages. If you don't, the render queue just gets longer and longer and you'll see performance go down. It's not actually a JS problem, it's a GL issue that is being improperly handled.

In my experience this is the first thing to check.

audiovisualist's icon

that is not the problem, i reset the sketch object befor each drawing, to clear the command list.
i figured out that is a strange behavior between max5 and max6. in max5 it runs like expected and in max6 it runs in an memory leak.
i rebuild the script now and test each function furthermore i will switch to java and write it as an external.
thanks for your pointing on the reset message.

Rob Ramirez's icon

make sure you update to the latest version of max 6. (.0.8).
we recently fixed a memory leak with opengl.

audiovisualist's icon

I updatet max, but the memory leak is still there. :(
I think rebuild from scratch is the solution, if i figured the leak out, i will post it here.