コード例 #1
0
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();
  }
}
コード例 #2
0
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();
	}
}
コード例 #3
0
void BasicScreenObject::draw() {

  // int elapsed = 0;

  if ((isvisible && _isParentTreeVisible && _isAddedToRenderer) || ismask) {

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

    if (hasmask)
      setupMask();

    glBlendFunc(sfactor, dfactor);

    lightingbefore = glIsEnabled(GL_LIGHTING);
    depthtestbefore = glIsEnabled(GL_DEPTH_TEST);

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

    if (lightingenabled && !lightingbefore)
      glEnable(GL_LIGHTING);
    if (!lightingenabled && lightingbefore)
      glDisable(GL_LIGHTING);

    ofPushMatrix();
    ofPushStyle();
    ofSetColor(color.r, color.g, color.b, getCombinedAlpha());
    _draw();
    ofPopStyle();
    ofPopMatrix();

    ofPushMatrix();
    drawChildren();
    ofPopMatrix();
    ofPushMatrix();
    _drawAfterChildren();
    ofPopMatrix();

    // lighting out
    if (lightingenabled && !lightingbefore)
      glDisable(GL_LIGHTING);
    if (!lightingenabled && lightingbefore)
      glEnable(GL_LIGHTING);

    // Depthtest out
    if (depthtestenabled && !depthtestbefore)
      glDisable(GL_DEPTH_TEST);
    if (!depthtestenabled && depthtestbefore)
      glEnable(GL_DEPTH_TEST);

    if (hasmask)
      restoreMask();

    glPopMatrix();
  }
}