comparison test/testgl.c @ 1912:8d384b647307

Setting up the OpenGL support
author Sam Lantinga <slouken@libsdl.org>
date Sun, 16 Jul 2006 09:34:01 +0000
parents c121d94672cb
children c785543d1843
comparison
equal deleted inserted replaced
1911:7577fd11cee4 1912:8d384b647307
455 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fsaa); 455 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fsaa);
456 } 456 }
457 if (accel) { 457 if (accel) {
458 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); 458 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
459 } 459 }
460 if (sync) {
461 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
462 } else {
463 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0);
464 }
465 if (SDL_SetVideoMode(w, h, bpp, video_flags) == NULL) { 460 if (SDL_SetVideoMode(w, h, bpp, video_flags) == NULL) {
466 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); 461 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
467 SDL_Quit(); 462 SDL_Quit();
468 exit(1); 463 exit(1);
464 }
465 if (sync) {
466 SDL_GL_SetSwapInterval(1);
467 } else {
468 SDL_GL_SetSwapInterval(0);
469 } 469 }
470 470
471 printf("Screen BPP: %d\n", SDL_GetVideoSurface()->format->BitsPerPixel); 471 printf("Screen BPP: %d\n", SDL_GetVideoSurface()->format->BitsPerPixel);
472 printf("\n"); 472 printf("\n");
473 printf("Vendor : %s\n", glGetString(GL_VENDOR)); 473 printf("Vendor : %s\n", glGetString(GL_VENDOR));
496 if (accel) { 496 if (accel) {
497 SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value); 497 SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
498 printf("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value); 498 printf("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value);
499 } 499 }
500 if (sync) { 500 if (sync) {
501 SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL, &value); 501 printf("Buffer swap interval: requested 1, got %d\n",
502 printf("SDL_GL_SWAP_CONTROL: requested 1, got %d\n", value); 502 SDL_GL_GetSwapInterval());
503 } 503 }
504 504
505 /* Set the window manager title bar */ 505 /* Set the window manager title bar */
506 SDL_WM_SetCaption("SDL GL test", "testgl"); 506 SDL_WM_SetCaption("SDL GL test", "testgl");
507 507