/* carrega uma nova cena */ int load_cb(void) { char* filename = get_file_name(); /* chama o dialogo de abertura de arquivo */ char buffer[30]; if (filename==NULL) return 0; /* Le a cena especificada */ scene = sceLoad( filename ); if( scene == NULL ) return IUP_DEFAULT; sceGetCamera( scene, &camera ); camGetEye( camera, eye ); camGetScreenWidth( camera, &width ); camGetScreenHeight( camera, &height ); yc=0; if (image) imgDestroy(image); image = imgCreate( width, height ); IupSetfAttribute(label, "TITLE", "%3dx%3d", width, height); sprintf(buffer,"%3dx%3d", width, height); IupSetAttribute(canvas,IUP_RASTERSIZE,buffer); IupSetFunction (IUP_IDLE_ACTION, (Icallback) idle_cb); start_time = clock(); return IUP_DEFAULT; }
/* carrega uma nova cena */ int load_cb(void) { char* filename = get_file_name(); /* chama o dialogo de abertura de arquivo */ char buffer[30]; if (filename==NULL) return 0; /* Le a cena especificada */ scene = sceLoad( filename ); if( scene == NULL ) return IUP_DEFAULT; camera = sceGetCamera( scene ); eye = camGetEye( camera ); width = camGetScreenWidth( camera ); height = camGetScreenHeight( camera ); yc=0; if (image) imgDestroy(image); image = imgCreate( width, height ); IupSetfAttribute(label, "TITLE", "%3dx%3d", width, height); sprintf(buffer,"%3dx%3d", width, height); IupSetAttribute(canvas,IUP_RASTERSIZE,buffer); IupSetFunction (IUP_IDLE_ACTION, (Icallback) idle_cb); start_time = clock(); IupGLMakeCurrent(canvas); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); glEnd(); glFlush(); IupGLSwapBuffers(canvas); /* change the back buffer with the front buffer */ return IUP_DEFAULT; }