ofxKinect2
ofxKinect2 copied to clipboard
BodyStream: maximum number of style pushes
In case joints of a tracked body are outside of the tracking area, the following warning is logged to console, in case the BodyStream is drawn:
[warning] ofGraphics: ofPushStyle(): maximum number of style pushes << 32 reached, did you forget to pop somewhere?
The reason I found is the TrackingState check of joint0 and joint1 in Body::drawBone(..), ofxKinect2.cpp. Here there are two return statements in lines 1277 and 1282 without calling ofPopStyle(), first.
I suggest to add calls of ofPopStyle() before each return statement:
if((state0 == TrackingState_NotTracked) || (state1 == TrackingState_NotTracked))
{
ofPopStyle();
return;
}
if((state0 == TrackingState_Inferred) && (state1 == TrackingState_Inferred))
{
ofPopStyle();
return;
}