RID render_target_create(struct render *R, int width, int height, enum TEXTURE_FORMAT format) { RID tex = render_texture_create(R, width, height, format, TEXTURE_2D, 0); if (tex == 0) return 0; render_texture_update(R, tex, width, height, NULL, 0, 0); RID rt = create_rt(R, tex); glBindFramebuffer(GL_FRAMEBUFFER, R->default_framebuffer); R->last.target = 0; R->changeflag |= CHANGE_TARGET; if (rt == 0) { render_release(R, TEXTURE, tex); } CHECK_GL_ERROR return rt; }
/* * A simple walk of event sets: dispatch and print a event SET every 2 sec */ void walk_el(int update_time, int time_between, int verb) { struct el *el; struct es *es_hd; struct es *es; assert (g_el->next); assert (get_myid >= 0); print_el(); /* initialize link set, routing table, and routing table */ create_ls(); create_rt(); init_rt_from_n2h(); for (el = g_el->next ; el != g_el ; el = el->next) { assert(el); es_hd = el->es_head; assert (es_hd); int *updated = (int *) calloc(256, sizeof(int)); struct es *myCurrES = es_hd->next; while(myCurrES->ev != _es_null){ if(myCurrES->ev == _es_link){ if(get_myid() == myCurrES->peer0){ update_rte(myCurrES->peer1, myCurrES->cost, myCurrES->peer1); updated[myCurrES->peer1] = 1; }else{ update_rte(myCurrES->peer0, myCurrES->cost, myCurrES->peer0); updated[myCurrES->peer0] = 1; } }else if(myCurrES->ev == _td_link){ struct link *linkToTd = find_link(myCurrES->name); if(get_myid() == linkToTd->peer0){ update_rte(linkToTd->peer1, -1, linkToTd->peer1); updated[myCurrES->peer1] = 1; }else{ update_rte(linkToTd->peer0, -1, linkToTd->peer0); updated[myCurrES->peer0] = 1; } }else if(myCurrES->ev == _ud_link){ struct link *linkToUd = find_link(myCurrES->name); if(get_myid() == linkToUd->peer0){ update_rte(linkToUd->peer1, myCurrES->cost, linkToUd->peer1); updated[myCurrES->peer1] = 1; }else{ update_rte(linkToUd->peer0, myCurrES->cost, linkToUd->peer0); updated[myCurrES->peer0] = 1; } } myCurrES = myCurrES->next; } printf("[es] >>>>>>>>>> Dispatch next event set <<<<<<<<<<<<<\n"); for (es=es_hd->next ; es!=es_hd ; es=es->next) { printf("[es] Dispatching next event ... \n"); dispatch_event(es); } runDVA(updated, 1); sleep(3); printf("[es] >>>>>>> Start dumping data stuctures <<<<<<<<<<<\n"); print_n2h(); print_ls(); print_rt(); } }