void open_main_window() { int xtmp, ytmp; WindowParams bwin; WinUnion wun; init_main_menu(); /* the main menu must be created *before* the SIMM window */ glueSetWindowPlacement(GLUT_NORMAL_WINDOW, GLUE_CENTER, root.gldesc.max_screen_x, root.gldesc.max_screen_y, 0, 0, NULL); bwin.id = glueOpenWindow("simm",no,GLUE_NO_WINDOW_FLAGS); glueSetWindowMinSize(950,700); #if SIMM_DEMO_VERSION sprintf(buffer,"%s - Tryout Version (%s)", program_name, program_version); #elif SIMM_VIEWER sprintf(buffer,"%s (%s)", program_name, program_version); #elif defined WIN32 strcpy(buffer, program_with_version); if (is_in_demo_mode()) strcat(buffer, " - Demo Mode"); #else sprintf(buffer,"%s: %s, %s %s", program_name, program_full_name, program_version, copyright_notice); #endif mstrcpy(&bwin.name,buffer); glutSetIconTitle(program_name); glutSetWindowTitle(bwin.name); wun.tool = NULL; root.basewindow = add_window(&bwin,&wun,NOTYPE,-1,no,display_background, update_background,background); if (root.basewindow == -1) error(exit_program,tool_message); glutSetWindowData(bwin.id, root.basewindow); glueGetWindowOrigin(&root.surgwin.x1,&root.surgwin.y1); glueGetWindowSize(&xtmp,&ytmp); root.surgwin.x2 = root.surgwin.x1 + xtmp; root.surgwin.y2 = root.surgwin.y1 + ytmp; }
void updateState(int v, maze* mazeScheme){ counter++; if(counter == 10){ duration--; counter = 0; } stringstream timeCounter; // stringstream used for the conversion timeCounter << duration;//add the value of Number to the characters in the stream string text = "Maze escape! - time: "+timeCounter.str()+"/100 - Orientation: "+getOrientation(); stringstream disabledAlarms; // stringstream used for the conversion disabledAlarms<< mazeScheme->getDisabledAlarmNum(); text+= " - Disabled Alarms: "+ disabledAlarms.str() +"/"; stringstream alarms; // stringstream used for the conversion alarms<<mazeScheme->getAlarmNum(); text+= alarms.str(); glutSetWindowTitle( (text.c_str())); }
void mouse(int b, int s, int x, int y) { float selx, sely; mousex = x; mousey = y; curX = x; curY = y; if (s == GLUT_DOWN) { switch (b) { case GLUT_LEFT_BUTTON: if (solving) { freeSolutions(); solving = 0; glutChangeToMenuEntry(1, "Solving", 1); glutSetWindowTitle("glpuzzle"); movingPiece = 0; } left_mouse = GL_TRUE; sel_piece = selectPiece(mousex, mousey); if (computeCoords(sel_piece, mousex, mousey, &selx, &sely)) { grabPiece(sel_piece, selx, sely); } glutPostRedisplay(); break; case GLUT_MIDDLE_BUTTON: middle_mouse = GL_TRUE; glutPostRedisplay(); break; } } else { switch (b) { case GLUT_LEFT_BUTTON: left_mouse = GL_FALSE; dropSelection(); glutPostRedisplay(); break; case GLUT_MIDDLE_BUTTON: middle_mouse = GL_FALSE; glutPostRedisplay(); break; } } motion(x, y); }
void main_menu_select(int value) { char title[512]; switch(value) { case 1: face_reset ( face ) ; glutPostRedisplay(); break; case 2: print_mesg(); break; case 3: face->muscle[m]->mstat += 0.25 ; activate_muscle ( face, face->muscle[m]->head, face->muscle[m]->tail, face->muscle[m]->fs, face->muscle[m]->fe, face->muscle[m]->zone, +0.25 ) ; glutPostRedisplay(); break; case 4: face->muscle[m]->mstat -= 0.25 ; activate_muscle ( face, face->muscle[m]->head, face->muscle[m]->tail, face->muscle[m]->fs, face->muscle[m]->fe, face->muscle[m]->zone, -0.25 ) ; glutPostRedisplay(); break; case 5: m++ ; if ( m >= face->nmuscles ) m = 0 ; sprintf(title, "geoface (%s)", face->muscle[m]->name); glutSetWindowTitle(title); break; case 666: exit(0); break; } }
void AutoQATest() { if (g_CheckRender && g_CheckRender->IsQAReadback()) { char temp[256]; sprintf(temp, "%s <%s>", "[AutoTest]:", filterMode[g_Kernel]); glutSetWindowTitle(temp); g_Kernel++; if (g_Kernel > 3) { g_Kernel = 0; printf("Summary: %d errors!\n", g_TotalErrors); printf("\tTEST: %s\n", (g_TotalErrors==0) ? "OK" : "FAILURE"); exit(0); } } }
/// Sets a title of a view. Function has to be called just from the inside of view thread with a locked sync_view. static int set_view_title_in_thread(void* title_pars_ptr) { debug_assert(!need_safe_call(), "E set_view_title_in_thread called from other thread."); TitleParams& title_params = *((TitleParams*)title_pars_ptr); std::map<int, View*>::iterator found_view = view_instances.find(title_params.view_id); //debug_assert(found_view != view_instances.end(), "E removing of a view that is not registered"); if (found_view == view_instances.end()) { debug_log("W settings title of a view that is not registered."); return -1; } //create GLUT window glutSetWindow(title_params.view_id); glutSetWindowTitle(title_params.title); return 0; }
static void runDemo(chipmunkDemo *demo) { if(currDemo) currDemo->destroyFunc(); currDemo = demo; ticks = 0; mouseJoint = NULL; messageString[0] = '\0'; maxArbiters = 0; maxPoints = 0; maxConstraints = 0; space = currDemo->initFunc(); glutSetWindowTitle(demoTitle(currDemo)); }
void AutoQATest() { if (g_CheckRender && g_CheckRender->IsQAReadback()) { char temp[256]; g_SobelDisplayMode = (SobelDisplayMode)g_Index; sprintf(temp, "%s Mean Shift Segmentation (%s)", "AutoTest:", filterMode[g_SobelDisplayMode]); glutSetWindowTitle(temp); g_Index++; if (g_Index > 2) { g_Index = 0; printf("Summary: %d errors!\n", g_TotalErrors); printf("Test %s!\n", (g_TotalErrors==0) ? "PASSED" : "FAILED"); exit(0); } } }
/////////////////////////////////////////////////////////////////////////////// // // draw_pt function // // author: Shaun Gruenig, Hannah Aker, Kelsey Bellew // // description: This function call the appropriate GUI functions to create // a graphical representation of the page table. // // /////////////////////////////////////////////////////////////////////////////// void draw_pt ( void ) { glClear ( GL_COLOR_BUFFER_BIT ); glutSetWindowTitle ( "Page Table" ); int i, yval; string t; stringstream out; char temp; char *f; int size = ptvec.size(); for ( i = 0; i < size / 2; i++ ) { yval = ScreenHeight - 30 * i - 20; out << i << " "; out << ( bitset < sizeof ( data ) * 8 - PAGE_SIZE > ) ptvec[i]; t = out.str(); f = ( char* ) t.c_str(); DrawTextString ( f, 2, yval, Black ); out.str ( "" ); } for ( i = size / 2; i < size; i++ ) { yval = ScreenHeight - 30 * ( i - size / 2 ) - 20; out << i << " "; out << ( bitset < sizeof ( data ) * 8 - PAGE_SIZE > ) ptvec[i]; t = out.str(); f = ( char* ) t.c_str(); DrawTextString ( f, 122, yval, Black ); out.str ( "" ); } for ( i = 0; i < size; i++ ) { yval = ScreenHeight - 30 * i; DrawRectangle ( 20, yval, 120, yval - 30, Black ); DrawRectangle ( 140, yval, 240, yval - 30, Black ); } glFlush(); }
void CG1Helper::m_displayFunc() { char WinTitle [100]; double Framerate = 0; double MSPF = 0; glClearColor(0.0f,0.0f,0.0f,1.0f); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); double m = GetMicroSec(); smProgramStep(); Framerate = 1000000.0/(GetMicroSec()-current_time); MSPF = (GetMicroSec()-m)*0.001; current_time=GetMicroSec(); #ifdef WIN32 sprintf_s(WinTitle, sizeof(WinTitle),"Computergraphik I Template /// %3.1f FPS (%3.4f ms per actual draw)", Framerate, MSPF); #else snprintf(WinTitle, sizeof(WinTitle),"Computergraphik I Template /// %3.1f FPS (%3.4f ms per actual draw)", Framerate, MSPF); #endif glutSetWindowTitle(WinTitle); if(smFrameBuffer->colorBuffer.getDataPointer()) { glBindTexture(GL_TEXTURE_2D,FBTexture); glTexSubImage2D(GL_TEXTURE_2D,0,0,0,smFrameBuffer->getWidth(),smFrameBuffer->getHeight(),GL_RGBA,GL_UNSIGNED_BYTE,smFrameBuffer->colorBuffer.getDataPointer()); glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); glTexCoord2f(0,0); glVertex2f(-1,-1); glTexCoord2f(1,0); glVertex2f( 1,-1); glTexCoord2f(1,1); glVertex2f( 1, 1); glTexCoord2f(0,1); glVertex2f(-1, 1); glEnd(); glDisable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,0); int scale = glcontextWidth/smFrameBuffer->getWidth(); if (scale>=3) drawGrid(glcontextWidth, glcontextHeight, scale); } glutSwapBuffers(); }
void renderScene(void) { static float step = 0.0f; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // set camera matrix setCamera(camX,camY,camZ,0,0,0); // set the model matrix to the identity Matrix setIdentityMatrix(modelMatrix,4); // sets the model matrix to a scale matrix so that the model fits in the window scale(scaleFactor, scaleFactor, scaleFactor); // keep rotating the model rotate(step, 0.0f, 1.0f, 0.0f); // use our shader glUseProgram(program); // we are only going to use texture unit 0 // unfortunately samplers can't reside in uniform blocks // so we have set this uniform separately glUniform1i(texUnit,0); recursive_render(scene, scene->mRootNode); // FPS computation and display frame++; time=glutGet(GLUT_ELAPSED_TIME); if (time - timebase > 1000) { sprintf(s,"FPS:%4.2f", frame*1000.0/(time-timebase)); timebase = time; frame = 0; glutSetWindowTitle(s); } // swap buffers glutSwapBuffers(); // increase the rotation angle //step++; }
//-------------------------------------------------------------- void testApp::setup() { // ofSoundStreamListDevices(); ofSetBackgroundAuto(false); ofBackground(0,0,0); ofSetFrameRate(1000/(10)); glutSetWindowTitle("MarPanning3D"); font.loadFont("fonts/HelveticaBold.ttf", 14); // brute force init manualRotation.set(30, 0, 0); offset.set(INITIAL_OFFSET); net.setup(); #ifdef USE_GUI defaultSimpleGuiConfig.fontName = "fonts/Helvetica.ttf"; defaultSimpleGuiConfig.fontSize = 10; defaultSimpleGuiConfig.setup(); gui.setup(); defaultSimpleGuiConfig.setup(); rotation_gui.setup(); // Sliders to rotate the object on its axes rotation_gui.addSlider("X Rotation", rotation.x, ROTATION_RANGE); rotation_gui.addSlider("Y Rotation", rotation.y, ROTATION_RANGE); rotation_gui.addSlider("Z Rotation", rotation.z, ROTATION_RANGE); rotation_gui.setPos(8, 8); rotation_gui.enableAllEvents(); // gui.setup(); gui.addSlider("Rotation X", net.rot.x, 0., 360.); gui.addSlider("Rotation Y", net.rot.y, 0., 360.); gui.addSlider("Rotation Z", net.rot.z, 0., 360.); gui.addToggle("Playing", net.play_state); // gui.setPos(8, rotation_gui.height+16); // gui.enableAllEvents(); #endif }
// Renderizes the entire scene // Tells the objects to render and updates the fps counter void ProgramGL::renderFunc() { // FPS std::string title = windowTitle + (string)" [" + tostr((int)fps) + (string)" fps]"; glutSetWindowTitle(title.c_str()); UpdateViewWithCamera(); // Limpiar el buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); for (size_t i = 0; i < objects.size(); i++){ objects[i]->renderFunc(); } glutSwapBuffers(); }
void computeFPS() { frameCount++; fpsCount++; if (fpsCount == fpsLimit) { char fps[256]; float ifps = 1.f / (sdkGetAverageTimerValue(&timer) / 1000.f); sprintf(fps, "%s (sigma=%4.2f): %3.1f fps", sSDKsample, sigma, ifps); glutSetWindowTitle(fps); fpsCount = 0; fpsLimit = ftoi(MAX(ifps, 1.f)); sdkResetTimer(&timer); } }
void computeFPS() { frameCount++; fpsCount++; if (fpsCount == fpsLimit) { char fps[256]; float ifps = 1.f / (sdkGetAverageTimerValue(&timer) / 1000.f); sprintf(fps, "CUDA Particles (%d particles): %3.1f fps", numParticles, ifps); glutSetWindowTitle(fps); fpsCount = 0; fpsLimit = (int)MAX(ifps, 1.f); sdkResetTimer(&timer); } }
void update(int value) { updateAnimations(); updatePointer(); updatePlayer(); updateBullet(); updateCubes(); updateExplosions(); updateScore(); // comunica cata cuburi mai sunt sprintf_s(_windowTitle, 39, "JakCube - %d cubes left", _evilCubes.size()); _windowTitle[39] = NULL; glutSetWindowTitle(_windowTitle); glutPostRedisplay(); glutTimerFunc(25, update, 0); }
void computeFPS() { frameCount++; fpsCount++; if (fpsCount == fpsLimit) { avgFPS = 1.f / (sdkGetAverageTimerValue(&timer) / 1000.f); fpsCount = 0; fpsLimit = (int)MAX(avgFPS, 1.f); sdkResetTimer(&timer); } char fps[256]; sprintf(fps, "MPI Cuda GL Interop (VBO): %3.1f fps (Max 100Hz)", avgFPS); glutSetWindowTitle(fps); }
// Simple method to display the Frames Per Second in the window title void computeFPS() { static int fpsCount=0; static int fpsLimit=100; fpsCount++; if (fpsCount == fpsLimit) { char fps[256]; float ifps = 1.f / (cutGetAverageTimerValue(timer) / 1000.f); sprintf(fps, "Cuda GL Interop Wrapper: %3.1f fps ", ifps); glutSetWindowTitle(fps); fpsCount = 0; cutilCheckError(cutResetTimer(timer)); } }
void computeFPS() { frameCount++; fpsCount++; if (fpsCount == fpsLimit) { char fps[256]; float ifps = 1.f / (sdkGetAverageTimerValue(&timer) / 1000.f); sprintf(fps, "CUDA 3D Volume Filtering: %3.1f fps", ifps); glutSetWindowTitle(fps); fpsCount = 0; fpsLimit = MAX(1.f, ifps); sdkResetTimer(&timer); } }
void computeFPS() { frameCount++; fpsCount++; if (fpsCount == fpsLimit) { char fps[256]; float ifps = 1.f / (sdkGetAverageTimerValue(&timer) / 1000.f); sprintf(fps, "<%s>: %3.1f fps", filterMode[g_Kernel], ifps); glutSetWindowTitle(fps); fpsCount = 0; //fpsLimit = (int)MAX(ifps, 1.f); sdkResetTimer(&timer); } }
void OPGL::PreformanceCheck(int value){ if(!showPreformance) return; if (value) { char *TempString = new char[22]; sprintf( TempString, "RANDOM SHOT, %d fps", fps * 4 ); glutSetWindowTitle(TempString); delete[] TempString; TempString = 0; } fps = 0; }
void animate(void) { if (spinning) { add_quats(lastquat, curquat, curquat); } glutPostRedisplay(); if (solving) { if (!continueSolving()) { solving = 0; glutChangeToMenuEntry(1, "Solving", 1); glutSetWindowTitle("glpuzzle"); } } if (!solving && !spinning && !visible) { glutIdleFunc(NULL); } }
/////////////////////////////////////////////////////////// // Parse the selection buffer to see which // planet/moon was selected void ProcessPlanet(GLuint *pSelectBuff) { int id,count; char cMessage[64]; strcpy(cMessage,"Error, no selection detected"); // How many names on the name stack count = pSelectBuff[0]; // Bottom of the name stack id = pSelectBuff[3]; // Select on earth or mars, whichever was picked switch(id) { case EARTH: strcpy(cMessage,"You clicked Earth."); // If there is another name on the name stack, // then it must be the moon that was selected // This is what was actually clicked on if(count == 2) strcat(cMessage," - Specifically the moon."); break; case MARS: strcpy(cMessage,"You clicked Mars."); // We know the name stack is only two deep. The precise // moon that was selected will be here. if(count == 2) { if(pSelectBuff[4] == MOON1) strcat(cMessage," - Specifically Moon #1."); else strcat(cMessage," - Specifically Moon #2."); } break; } // Display the message about planet and moon selection glutSetWindowTitle(cMessage); }
void renderScene(void) { // clear buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // set the camera glLoadIdentity(); //Vê o glutAt a usar if (tipo_camera==1) modo_explorador(); else if (tipo_camera==2) modo_fps(); else{ gluLookAt(0,3,5, 0.0, 0.0, 0.0, 0.0f, 1.0f, 0.0f); } // pÙr instruÁıes de desenho aqui //LUZES defineLuzes(); //Actualiza apontadores rot_actual=rotacoes; tra_actual=translacoes; esc_actual=escalas; prop_actual=l_PropModel; n_desenhos=0; //Actualiza do tempo currentTime = glutGet(GLUT_ELAPSED_TIME); motor_XML(cena); //Alterar titulo da janela a cada frame sprintf(print, "Galaxy 3D ® => %d/%d desenhados\n",n_desenhos, total_desenhos); glutSetWindowTitle(print); // End of frame glutSwapBuffers(); }
void display(){ runCuda(); string title = "565Raytracer | " + utilityCore::convertIntToString(iterations) + " Iterations"; glutSetWindowTitle(title.c_str()); glBindBuffer( GL_PIXEL_UNPACK_BUFFER, pbo); glBindTexture(GL_TEXTURE_2D, displayImage); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glClear(GL_COLOR_BUFFER_BIT); // VAO, shader program, and texture already bound glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0); glutPostRedisplay(); glutSwapBuffers(); }
void display() { static float fps = 0; frame++; int time=glutGet(GLUT_ELAPSED_TIME); if (time - timebase > 1000) { fps = frame*1000.0f/(time-timebase); timebase = time; frame = 0; } float executionTime = glutGet(GLUT_ELAPSED_TIME) - timeSinceLastFrame; timeSinceLastFrame = glutGet(GLUT_ELAPSED_TIME); runCuda(); char title[100]; sprintf( title, "Flocking Simulation [%0.2f fps] [%0.2fms] ", fps, executionTime); glutSetWindowTitle(title); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); #if VISUALIZE == 1 glUseProgram(program[PASS_THROUGH]); glEnableVertexAttribArray(positionLocation); glBindBuffer(GL_ARRAY_BUFFER, planetVBO); glVertexAttribPointer((GLuint)positionLocation, 4, GL_FLOAT, GL_FALSE, 0, 0); glEnableVertexAttribArray(velocityLocation); glBindBuffer(GL_ARRAY_BUFFER, velocityVBO); glVertexAttribPointer((GLuint)velocityLocation, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, planetIBO); glPointSize(4.0f); glDrawElements(GL_POINTS, N_FOR_VIS, GL_UNSIGNED_INT, 0); glDisableVertexAttribArray(positionLocation); // Draw_Axes(); #endif glutPostRedisplay(); glutSwapBuffers(); }
void computeFPS() { frameCount++; fpsCount++; if (fpsCount == fpsLimit) { char fps[256]; //float ifps = 1.f / (cutGetAverageTimerValue(timer) / 1000.f); float ifps = 1.f / (sdkGetAverageTimerValue(&timer) / 1000.f); sprintf(fps, "Dam Break (%d particles): %3.1f fps; elapsed Time: %f", psystem->getNumParticles(), ifps, psystem->getElapsedTime()); glutSetWindowTitle(fps); fpsCount = 0; //cutilCheckError(cutResetTimer(timer)); sdkResetTimer(&timer); } }
void computeFPS() { frameCount++; fpsCount++; if (fpsCount == fpsLimit) { char fps[256]; float ifps = 1.f / (sdkGetAverageTimerValue(&timer) / 1000.f); sprintf(fps, "FunctionPointers [CUDA Edge Detection] (%s): %3.1f fps", filterMode[g_SobelDisplayMode], ifps); glutSetWindowTitle(fps); fpsCount = 0; fpsLimit = (int)MAX(ifps, 1.f); sdkResetTimer(&timer); } }
static void timerCallback (int value) { if (0 != value) { char* TempString = (char*) malloc(512 + strlen(WINDOW_TITLE_PREFIX)); sprintf( TempString, "%s @ %d x %d", WINDOW_TITLE_PREFIX, CurrentWidth, CurrentHeight ); glutSetWindowTitle(TempString); free(TempString); } glutTimerFunc(250, timerCallback, 1); }
void InitGraphics( ) { glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH ); glutInitWindowPosition( 0, 0 ); glutInitWindowSize( INIT_WINDOW_SIZE, INIT_WINDOW_SIZE ); MainWindow = glutCreateWindow( WINDOWTITLE ); glutSetWindowTitle( WINDOWTITLE ); glClearColor( BACKCOLOR[0], BACKCOLOR[1], BACKCOLOR[2], BACKCOLOR[3] ); // setup the callback routines: glutSetWindow( MainWindow ); glutDisplayFunc( Display ); glutReshapeFunc( Resize ); glutKeyboardFunc( Keyboard ); glutMouseFunc( MouseButton ); glutMotionFunc( MouseMotion ); glutPassiveMotionFunc( NULL ); glutVisibilityFunc( Visibility ); glutEntryFunc( NULL ); glutSpecialFunc( NULL ); glutSpaceballMotionFunc( NULL ); glutSpaceballRotateFunc( NULL ); glutSpaceballButtonFunc( NULL ); glutButtonBoxFunc( NULL ); glutDialsFunc( NULL ); glutTabletMotionFunc( NULL ); glutTabletButtonFunc( NULL ); glutMenuStateFunc( NULL ); glutTimerFunc( 0, NULL, 0 ); #ifdef WIN32 GLenum err = glewInit(); if( err != GLEW_OK ) { fprintf( stderr, "glewInit Error\n" ); } #endif }