void DisplayList::drawPrims(string appearance) {
	vector<MyPrimitive *>::const_iterator it;

	for (it = prims.begin(); it != prims.end(); it++) {
		Appearance *app = Scene::getInstance()->getAppearance(appearance);
		app->apply();
		(*it)->setAppearance(appearance);
		(*it)->draw();
		(*it)->clearAppearance();
	}
}
void ProjectScene::processDisplayLists(Node* n, Node* graphRoot){
	
	
	if (n->getAppearance() != NULL)
		n->getAppearance()->apply();
	int numFilhos = n->getDescendentes().size();
	for (int i = 0; i < numFilhos; i++){
		this->processDisplayLists(n->getDescendenteIndex(i), graphRoot);
	}


	if (n->getDisplayList()){
		//printf("nome do no: %s\n", n->getId().c_str());
		
		printf("---------------------------\nfazer lista:\n");

		Appearance*  temp = new Appearance();
		if (n->getAppearance() == NULL){
			//printf("vai procurar aparencia aos ascendentes\n");
			temp = getClosestParentAppearance(graphRoot, n);
		}
		else temp = n->getAppearance();
		
		if (temp != NULL) temp->apply();

		n->setAparencia(temp);
		printf("	nome aparencia: %s\n",temp->getId());




		if (n->getDisplayListID() == -1){
			int id = glGenLists(1);
			n->setDisplayListID(id);

			n->setDisplayList(false); //serve para forçar o drawAux a desenhar 
									  //este nó como um nó "normal" (sem lista)

			glNewList(n->getDisplayListID(), GL_COMPILE);
				this->drawAux(n);
			glEndList();

			n->setDisplayList(true); //restaura a "true" após o processamento do nó

			printf("fim lista:\n---------------------------\n");
		}
	
	}
}