void BasicInteractiveObject::drawForPicking(){
	if (isVisible() && isParentTreeVisible()) {
		
		glPushMatrix();
		glMultMatrixf(getLocalTransformMatrix().getPtr());
		
		if (hasmask) setupMask();
		
		depthtestbefore = glIsEnabled(GL_DEPTH_TEST);
		if (depthtestenabled && !depthtestbefore)glEnable(GL_DEPTH_TEST);
		if (!depthtestenabled && depthtestbefore)glDisable(GL_DEPTH_TEST);
		
		ofPushStyle();
		ofColor pickingColor = pickingNameToColor(pickingName);
		ofSetColor(pickingColor.r, pickingColor.g, pickingColor.b);
		_drawForPicking();
		ofPopStyle();			
		
		drawChildrenForPicking();
		
		if(depthtestenabled && !depthtestbefore){
			glDisable(GL_DEPTH_TEST);
		}
		if(!depthtestenabled && depthtestbefore){
			glEnable(GL_DEPTH_TEST);
		}
		if(hasmask) restoreMask();		
		glPopMatrix();
	}
}
void BasicScreenObject::drawForPicking() {
  if (isvisible && _isParentTreeVisible && _isAddedToRenderer) {

    glPushMatrix();
    glMultMatrixf(getLocalTransformMatrix().getPtr());

    if (hasmask) {
      setupMask();
    }

    depthtestbefore = glIsEnabled(GL_DEPTH_TEST);
    if (depthtestenabled && !depthtestbefore)
      glEnable(GL_DEPTH_TEST);
    if (!depthtestenabled && depthtestbefore)
      glDisable(GL_DEPTH_TEST);

    drawChildrenForPicking();

    if (depthtestenabled && !depthtestbefore) {
      glDisable(GL_DEPTH_TEST);
    }
    if (!depthtestenabled && depthtestbefore) {
      glEnable(GL_DEPTH_TEST);
    }
    if (hasmask) {
      restoreMask();
    }
    glPopMatrix();
  }
}