Hello All,
I’m new to ofx, but not so much to C++.
I have some fairly heavy code doing openCV segmentation and clustering. All this code is in custom classes I’ve included in the ofx project. I’m using ofx v0071 linux64 on an ubuntu precise machine, ofxCv and lots of opencv::gpu calls.
I’m early in the implementation, so I’m not paying attention to performance yet. I’m now running about 3fps, as reported by ofGetLastFrameTime(), and the framerate is set to 1fps. I’m currently dumping the image buffer to disk to see what is going on using grabScreen().
Although update() continues to run, it seems at some point (it seems to happen at a different point each time I run, and I keep adding additional debugging code each time.) in execution draw() simply stops being called.
After a closer look at the output, it’s even worse, it seems at a later point in execution that draw() miraculously starts getting called again…
I’m not using too much RAM, but certainly using a lot of CPU usage, and perhaps a fair bit of GPU.
Are there cases when draw() is not longer called? For example when some limit has exceeded, like the time to render one frame? or for update() to return?
Any hints as to where to look to debug this would be appreciated.
Also, ofGetFrameNum returns the same value for each update when draw() is not called.
In the long-run I will be moving much of this segmentation / clustering code into its own thread (dual core machine). So if I am just doing too much in update() for ofx, maybe jumping into the threading code is a good idea…
I’ll attach code if requested. Its very ugly at this point, and requires a sequence of 100s of images, uses the Makefile and not code::blocks, depends on ofxCv and you must have openCV compiled with gpu support.
UPDATE:
The bad news is that the point at which draw() stops being called is different depending on the execution of the same binary. So I’m really not sure of how to debug this. Start tearing out code until it stops happening I suppose. For a visual illustration of the problem, see the attached image, where the dashed line shows where update() continues to be called, but draw() stops. UpdateCounter is just an int that gets incremented in update(). I’ll continue testing and report back.