void Game::init(int* argcp, char** argvp) { glutInit(argcp, argvp); glutInitDisplayMode( GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE); glutInitWindowSize (480, 480); glutInitContextVersion( 3, 2 ); glutInitContextProfile( GLUT_CORE_PROFILE ); glutCreateWindow ("Ablockalypse"); glutSetWindowTitle("Ablockalypse"); glutSetIconTitle("Ablockalypse"); glewExperimental = GL_TRUE; glewInit (); // do shader stuff here... GLuint program = InitShader( "vshader.glsl", "fshader.glsl" ); glUseProgram( program ); vPosition = glGetAttribLocation( program, "vPosition" ); vColor = glGetAttribLocation( program, "vColor" ); xlate = glGetUniformLocation( program, "xlate" ); initGeometry (paddle); initGeometry (ball); initBricks (); glEnable( GL_DEPTH_TEST ); glClearColor(0, 0, 0, 0); }
void GlutWindow::setCaption(const std::string& caption) { if (caption != _windowTitle) { _windowTitle = caption; glutSetWindowTitle(caption.c_str()); glutSetIconTitle(caption.c_str()); } }
///////////////////////////////////////////////////////// // titleMess // ///////////////////////////////////////////////////////// void gemglutwindow :: titleMess(std::string s) { m_title = s; if(makeCurrent()){ glutSetWindowTitle(m_title.c_str()); glutSetIconTitle(m_title.c_str()); } }
static void hugsprim_glutSetIconTitle_17(HugsStackPtr hugs_root) { HsPtr arg1; arg1 = hugs->getPtr(); glutSetIconTitle(arg1); hugs->returnIO(hugs_root,0); }
/* Creates the actual window based on the window properties set in the configuration struct. */ bool createWindow(void) { // Set up our window to have a color buffer and have it double buffered. glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); // Set the size and position of the window. glutInitWindowSize(c->x_res, c->y_res); glutInitWindowPosition(c->win_x, c->win_y); // Create the window. glutCreateWindow(c->title); // Give the window an icon glutSetIconTitle("assets\\images\\dependent\\icon.png"); // Remove the cursor when it is over the window. glutSetCursor(GLUT_CURSOR_NONE); // Store the fullscreen variable for switching awareness. fullscreen = c->fullscr; // Make the window fullscreen if necessary. if(fullscreen) glutFullScreen(); // Set a basic clear color for OpenGL. glClearColor(c->clr_r, c->clr_g, c->clr_b, 1); // Enable alpha rendering. glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // F*****G ENABLE DEPTH TESTING. glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); // Enable texturing. glEnable(GL_TEXTURE_2D); // Set the viewport to take up the entire window. glViewport(0, 0, c->x_res/2, c->y_res); // Pass in our callbacks. glutDisplayFunc(render); glutIdleFunc(render); glutWindowStatusFunc(visibilityFunc); // If everything's gone well up until this point, we can return true. return true; }
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 keyboard(unsigned char key, int x, int y) { switch (key) { case 'f': if (!isFullScreen) { windowPos.x = (double)glutGet(GLUT_WINDOW_X); windowPos.y = (double)glutGet(GLUT_WINDOW_Y); windowSize.x = (double)glutGet(GLUT_WINDOW_WIDTH); windowSize.y = (double)glutGet(GLUT_WINDOW_HEIGHT); isFullScreen = true; glutFullScreen(); } else { glutReshapeWindow((int)windowSize.x, (int)windowSize.y); glutPositionWindow((int)windowPos.x, (int)windowPos.y); glutSetWindowTitle("NetworkMonitor"); glutSetIconTitle("NetworkMonitor"); isFullScreen = false; } break; case 'q': exit(0); } }
static void setup_glut() { int argc = 1; char *argv[1] = {"framebuffer"}; printf("width, height = %d, %d\n", gwidth, gheight); glutInit(&argc, argv); glutInitWindowPosition(100, 100); glutInitWindowSize(gwidth, gheight); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutCreateWindow(argv[0]); glutSetWindowTitle(argv[0]); glutSetIconTitle(argv[0]); glutReshapeFunc(reshape); glutDisplayFunc(display); glutKeyboardFunc(keyboard); glutIdleFunc(idle); glDisable(GL_DEPTH_TEST); glutMainLoop(); }
int main(int argc, char* argv[]) { int border, caption; glutInit( &argc, argv ); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE /*| GLUT_BORDERLESS*/); // do try as well with GLUT_BORDERLESS and GLUT_CAPTIONLESS glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE,GLUT_ACTION_GLUTMAINLOOP_RETURNS); /* Get border and caption size of default window style */ border = glutGet(GLUT_WINDOW_BORDER_WIDTH); caption = glutGet(GLUT_WINDOW_HEADER_HEIGHT); printf("default window style border: %dpx, caption: %dpx\n",border,caption); /* NB: The window position you request is the outer top-left of the * window, the client area is at a different position if the window has * borders and/or a title bar. */ glutInitWindowPosition(150,250); glutInitWindowSize(200,200); nWindow = glutCreateWindow("test"); glutSetIconTitle("test icon title"); printf("main window id: %d\n", nWindow); glutKeyboardFunc( SampleKeyboard ); glutDisplayFunc( Redisplay ); glutReshapeFunc( Reshape ); glutPositionFunc( Position ); glutWindowStatusFunc( WindowStatus ); glutTimerFunc(300, Timer, 0); glutMainLoop(); printf("glutMainLoop returned\n"); return EXIT_SUCCESS; }
/* new scene */ int createScene (pScene sc, int idmesh) { pMesh mesh; char data[128]; /* default */ mesh = cv.mesh[idmesh]; if (!quiet) fprintf(stdout, " Computing 3D scene\n"); /* set default mode */ sc->idmesh = idmesh; sc->par.xi = sc->par.yi = 10; if (option == SCHNAUZER) { sc->par.xs = schw; sc->par.ys = schh; } else { if (sc->par.xs == 0) sc->par.xs = 600; if (sc->par.ys == 0) sc->par.ys = 600; } if (!sc->mode) sc->mode = HIDDEN; sc->item = 0; sc->shrink = 1.0; sc->slave = sc->master = -1; sc->picked = 0; if (mesh->nvn == 0) sc->type ^= S_FLAT; if (mesh->ne == 0) sc->item |= S_GEOM; /* compute scene depth */ sc->dmax = sc->dmin = mesh->xmax - mesh->xmin; sc->dmax = max(sc->dmax, mesh->ymax - mesh->ymin); sc->dmin = min(sc->dmin, mesh->ymax - mesh->ymin); if (mesh->dim == 3) { sc->dmax = max(sc->dmax, mesh->zmax - mesh->zmin); sc->dmin = min(sc->dmin, mesh->zmax - mesh->zmin); } sc->dmax = fabs(sc->dmax); sc->dmin = fabs(sc->dmin); if (!sc->par.sunp) { sc->par.sunpos[0] *= 2.0 * sc->dmax; sc->par.sunpos[1] *= 2.0 * sc->dmax; sc->par.sunpos[2] *= 2.0 * sc->dmax; } sc->par.sunpos[3] = 1.0; /* create window */ glutInitWindowSize(sc->par.xs, sc->par.ys); sc->idwin = glutCreateWindow(""); assert(sc->idwin != 0); if (fullscreen) { glutFullScreen(); sc->par.xs = glutGet(GLUT_SCREEN_WIDTH); sc->par.ys = glutGet(GLUT_SCREEN_HEIGHT); } /* set window name */ sprintf(data, "Medit - [%s] #%d", mesh->name, sc->idwin); glutSetWindowTitle(data); glutSetIconTitle(data); /* required! to change background color */ glClearColor(sc->par.back[0], sc->par.back[1], sc->par.back[2], sc->par.back[3]); /* init perspective */ sc->persp = initPersp(0, sc->dmax); sc->camera = (pCamera)initCamera(sc, Y_AXIS); if (mesh->typ == 2) { sc->persp->pmode = CAMERA; sc->persp->depth *= 0.5; } /* create default view */ sc->view = (pTransform)createTransform(); if (!sc->view) return (0); sc->type |= S_RESET + S_DECO; sc->clip = (pClip)createClip(sc, mesh); if (!sc->clip) return (0); sc->cube = (pCube)createCube(sc, mesh); if (!sc->cube) return (0); /* create menus */ if (!createMenus(sc, mesh)) return (0); /* assign callbacks */ if (sc->type & S_SCISSOR) { glutDisplayFunc(scissorScene); } else if (option == SCHNAUZER) { glutDisplayFunc(redrawSchnauzer); } else if (sc->persp->pmode == CAMERA) { glutMouseFunc(mouseCamera); glutMotionFunc(motionCamera); glutDisplayFunc(redrawScene); } else { glutMouseFunc(mouse); glutMotionFunc(motion); glutDisplayFunc(redrawScene); } glutReshapeFunc(reshapeScene); glutKeyboardFunc(keyScene); glutSpecialFunc(special); glutAttachMenu(GLUT_RIGHT_BUTTON); /* create display lists by geom type */ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); doLists(sc, mesh); sc->glist = geomList(sc, mesh); sc->type |= S_FOLLOW; /* local stack */ if (!pilmat) { pilmat = (int *)calloc(sc->par.nbmat + 2, sizeof(int)); if (!pilmat) return (0); } /* color list */ setupPalette(sc, mesh); sc->stream = NULL; initGrafix(sc, mesh); return (1); }
void make_message_port(void) { IntBox bbox; HelpStruct* hp; int windex; WindowParams mwin; WinUnion wun; SBoolean iconified; hp = &root.messages; hp->lines_per_page = 10; hp->window_width = 750; hp->window_height = 10*HELP_WINDOW_TEXT_Y_SPACING + 4; hp->line = (TextLine*)simm_malloc(100*sizeof(TextLine)); if (hp->line == NULL) error(exit_program,tool_message); hp->num_lines_malloced = 100; hp->num_lines = 0; hp->starting_line = 0; hp->background_color = HELP_WINDOW_BACKGROUND; bbox.x2 = hp->window_width; bbox.x1 = bbox.x2 - 20; bbox.y2 = hp->window_height; bbox.y1 = 0; make_slider(&hp->sl,vertical_slider,bbox,0,(double)(hp->num_lines)*20.0, (double)(hp->lines_per_page)*20.0,(double)(hp->num_lines)*20.0,4.0,NULL,NULL); glueSetWindowPlacement(GLUT_NORMAL_WINDOW, GLUE_SOUTHWEST, hp->window_width, hp->window_height, 0, 0, NULL); #if defined WIN32 && SIMM_DEMO_VERSION iconified = is_in_demo_mode(); #else iconified = no; #endif mwin.id = hp->window_id = glueOpenWindow("simmmess",iconified,GLUE_TOOL_WINDOW); glueSetWindowMinSize(500,100); mstrcpy(&mwin.name,"SIMM Messages"); glutSetIconTitle("Messages"); glutSetWindowTitle(mwin.name); wun.tool = NULL; windex = add_window(&mwin,&wun,NOTYPE,ZERO,no,draw_message_window, update_message_window,messages_input); if (windex == -1) error(exit_program,tool_message); glutSetWindowData(mwin.id, windex); if (expirationMessage) { error(none, expirationMessage); FREE_IFNOTNULL(expirationMessage); } }
void ChangeTitleTimer(int unused) { glutSetIconTitle("new icon title"); glutSetWindowTitle("new test title"); }
void doSetWindowTitle(const std::string& title) { glutSetWindowTitle(title.c_str()); glutSetIconTitle(title.c_str()); }