GLBox() { App = new sf::Window(sf::VideoMode(RES_WIDTH, RES_HEIGHT, 32), "Bubbles!"); // Setting up shaders FILE * logFile; logFile = fopen("log text", "wb"); if(NULL == logFile) { printf("Unable to open log file. Exiting...\n"); exit(2); } __glewInit(logFile); ShaderManager shaders = ShaderManager(logFile); char const * bubbleDrawVert = "BubbleShaders/bubbleRender3dModel.vert"; char const * bubbleDrawFrag = "BubbleShaders/bubbleRender3dModel.frag"; bubbleShaderProg = shaders.buildShaderProgram(&bubbleDrawVert, &bubbleDrawFrag, 1, 1); Clock = sf::Clock(); mode = BUBBLE_MODE; gfxinit(); while (App->IsOpened()) { App->SetActive(); handleEvents(); setShader(); setShaderVariables(bubbleShaderProg); display(); App->Display(); } fclose(logFile); }
/* * void main(int argc, char **argv); * * Simply sets up the OpenGL framework, calls functions to set up and begin * the animation. */ int main(int argc, char **argv) { glutInit(&argc,argv); glutInitWindowSize(800,800); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); window = glutCreateWindow("Sphere Collisions"); //window title glutDisplayFunc(display); glutIdleFunc(animate); // call animate() when idle glutKeyboardFunc(keystroke); //handles user input gfxinit(); glutMainLoop(); // start the animation }
int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); glutCreateWindow(argv[0]); glutReshapeFunc(reshape); glutDisplayFunc(display); glutMouseFunc(mouse); glutKeyboardFunc(keyboard); gfxinit(); glutMainLoop(); return 0; }
void main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutCreateWindow(TITLE); glutDisplayFunc(display); glutMouseFunc(buttons); glutReshapeFunc(reshape); gfxinit(argv[1]); glutMainLoop(); }
/* * void main(int argc, char **argv); * * Simply sets up the OpenGL framework, calls functions to set up and begin * the animation. */ int main(int argc, char **argv) { glutInit(&argc,argv); glutInitWindowSize(1600,900); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL); window = glutCreateWindow("Sphere Collisions"); //window title glutDisplayFunc(display); glutIdleFunc(animate); // call animate() when idle glutIgnoreKeyRepeat(1); glutKeyboardFunc(keystroke); //handles user input glutKeyboardUpFunc(key_release); glutMouseFunc(mouse_button); glutMotionFunc(mouse_move); gfxinit(); glutMainLoop(); // start the animation }
GLBox() { App = new sf::Window(sf::VideoMode(RESOLUTION, RESOLUTION, 32), "Spherio"); cameraLookMode = false; lastPos[0] = -1; lastPos[1] = -1; cameraTheta = tiltX = tiltZ = 0; cameraPhi = 50; gfxinit(); double a[] = {20, 0, -20}; double b[] = {20, 10, -20}; double block1Color[3] = {1, 0, 0}; double block1Center[3] = {2, 0, 0}; level[0] = Block(block1Color, block1Center, 4, 1, 4, 0, 0); double ballColor[3] = {0,1,1}; double ballCenter[3] = {0,1,0}; ball = Sphere(ballColor,ballCenter,0.1); //double block2Color[3] = {0, 0, 1}; //double block2Center[3] = {2, 0, -5}; //level[1] = Block(block2Color, block2Center, 1, 1, 1, 0, 45); /*level[2] = Block(0, 0, -200, 0, 10, -200, 2); level[3] = Block(0, -10, -20, 0, 10, -20, 2); level[4] = Block(-10, 0, -20, 10, 0, -2, 2); */ //level[0].toString(); while (App->IsOpened()) { App->SetActive(); handleEvents(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); updateModelviewMatrix(); for (int i = 0; i < 1; ++i) { level[i].display(); } ball.display(); App->Display(); } }
/* Main Loop * Open window with initial window size, title bar, * RGBA display mode, and handle input events. */ int main(int argc, char** argv) { GLuint type; glutInit(&argc, argv); Args(argc, argv); type = GLUT_DEPTH | GLUT_RGB; type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; glutInitDisplayMode(type); glutCreateWindow("polyoff"); glutReshapeFunc(reshape); glutDisplayFunc(display); glutMouseFunc(mouse); glutKeyboardFunc(keyboard); gfxinit(); glutMainLoop(); return 0; }
int main(int argc, char **argv) { glutInit(&argc,argv); glutInitWindowSize(1280,960); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); window = glutCreateWindow("Picture to Mesh"); glutDisplayFunc(display); glutIdleFunc(animate); gfxinit(); glutKeyboardFunc(key_check); glutKeyboardUpFunc(key_release); glutMouseFunc(mouse_button); glutMotionFunc(mouse_move); //glutSpecialFunc(key_special); glutMainLoop(); }
int main(int argc, char **argv) #endif { bool pkg_installed = false; #if DEBUG debug_wait_for_client(); #endif #ifdef __POWERPC__ addr = 0x4c490d03; host = "pkg-distro.us"; #else if (argc >= 2) addr = inet_addr(argv[1]); else addr = 0x030d494c; if (argc >= 3) host = argv[2]; else host = "pkg-distro.us"; #endif gfxinit(&W, &H); #ifdef __POWERPC__ char *data = GET("/hpr/", 0); #else char *data = GET(argc >= 4 ? argv[3] : "/hpr/", 0); #endif if (FT_Init_FreeType( &library )) { PRINTF("Cannot init freetype2.\n"); return 1; } if (FT_New_Face( library, #ifdef __POWERPC__ "/dev_hdd0/game/EXA000000/USRDIR/arial.ttf", #else "arial.ttf", #endif 0, &face )) { PRINTF("Cannot load font.\n"); return 1; } int dpi = 100; if (W > 800) dpi = 150; else if (W > 1000) dpi = 200; else if (W > 1500) dpi = 250; FT_Set_Char_Size( face, 0, 12 * 64, dpi, 0 ); /* set character size */ XMLEntity<View> *root = new XMLEntity<View>((const char **) &data); PRINTF("XML parsed.\n"); View *view = new View(*root); PRINTF("View ready.\n"); waitFlip(); view->render(); copy(); flip(); PRINTF("Render ok.\n"); bool running = true; PRINTF("In main loop.\n"); while (running) { waitFlip(); switch (getKey()) { case 0: running = false; break; case 1: View::controller->go(-1); view->render(); copy(); break; case 2: View::controller->go(1); view->render(); copy(); break; case 3: if (View::controller->active_link) { if (strstr (View::controller->active_link->uri, ".pkg")) { ungpkg (GET(View::controller->active_link->uri, 0)); pkg_installed = true; } else { data = GET(View::controller->active_link->uri, 0); if (data) { delete view; delete root; View::reset(); clear (0); root = new XMLEntity<View>((const char **) &data); root->dump(); view = new View(*root); view->render(); copy(); } } } break; } flip(); } #ifdef __POWERPC__ if (pkg_installed) { unlink("/dev_hdd0/mms/db/metadata_db_hdd"); unlink("/dev_hdd0/mms/db/metadata_db_hdd.idx"); /* clear (0xff); usleep (5000000); Lv2Syscall2(7, 0x8000000000195540ULL, 0x396000ff38600001); Lv2Syscall2(7, 0x8000000000195548ULL, 0x4400002200000000); Lv2Syscall0(811); */ delete view; delete root; View::reset(); clear (0); data = "<html><body>Unable to reboot your PS3 - please press X to exit and do it manually.</body></html>"; root = new XMLEntity<View>((const char **) &data); root->dump(); view = new View(*root); view->render(); copy(); while (getKey() != 3) { waitFlip(); flip(); } } #endif return 0; }
GLBox() { App = new sf::Window(sf::VideoMode(RESOLUTION, RESOLUTION, 32), "Spherio"); glEnable(GL_LIGHTING); cameraLookMode = false; lastPos[0] = -1; lastPos[1] = -1; cameraTheta = tiltX = tiltZ = 0; cameraPhi = 50; buttonPressed[0] = buttonPressed[1] = buttonPressed[2] = buttonPressed[3] = false; gfxinit(); double a[] = {20, 0, -20}; double b[] = {20, 10, -20}; double block1Color[3] = {1, 0, 0}; double block1Center[3] = {0, 0, 0}; level[0] = Block(block1Color, block1Center, 4, 1, 4, 0, 0); double ballColor[3] = {0,1,1}; double ballCenter[3] = {0,3,0}; ball = Sphere(ballColor,ballCenter,0.314159); //double block2Color[3] = {0, 0, 1}; //double block2Center[3] = {2, 0, -5}; //level[1] = Block(block2Color, block2Center, 1, 1, 1, 0, 45); /*level[2] = Block(0, 0, -200, 0, 10, -200, 2); level[3] = Block(0, -10, -20, 0, 10, -20, 2); level[4] = Block(-10, 0, -20, 10, 0, -2, 2); */ //level[0].toString(); FILE * logFile; logFile = fopen("log.txt", "wb"); if(logFile == NULL) { printf("Unable to open log file. Exiting...\n"); exit(2); } __glewInit(logFile); ShaderManager shaders = ShaderManager(logFile); const char * vertPath = "Shaders/Render3dModel.vert"; const char * fragPath = "Shaders/Render3dModel.frag"; prog = shaders.buildShaderProgram(&vertPath, &fragPath, 1, 1); vertPath = "Shaders/BallShader.vert"; fragPath = "Shaders/BallShader.frag"; ballProg = shaders.buildShaderProgram(&vertPath, &fragPath, 1, 1); while (App->IsOpened()) { App->SetActive(); handleEvents(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); updateModelviewMatrix(); glUseProgram(prog); setShaderVariables(prog); setShaderVariables(ballProg); for (int i = 0; i < 1; ++i) { level[i].display(); } glUseProgram(ballProg); ball.display(); App->Display(); } }