comparison src/video/quartz/SDL_QuartzVideo.m @ 1658:e49147870aac SDL-1.3

glSDL support
author Sam Lantinga <slouken@libsdl.org>
date Mon, 01 May 2006 06:58:33 +0000
parents 0a53c90a37f9
children 14717b52abc0
comparison
equal deleted inserted replaced
1657:5b0805ceb50f 1658:e49147870aac
377 377
378 /* 378 /*
379 Release the OpenGL context 379 Release the OpenGL context
380 Do this first to avoid trash on the display before fade 380 Do this first to avoid trash on the display before fade
381 */ 381 */
382 if ( mode_flags & SDL_OPENGL ) { 382 if ( mode_flags & SDL_INTERNALOPENGL ) {
383 383
384 QZ_TearDownOpenGL (this); 384 QZ_TearDownOpenGL (this);
385 CGLSetFullScreen (NULL); 385 CGLSetFullScreen (NULL);
386 } 386 }
387 if (to_desktop) { 387 if (to_desktop) {
404 [ qz_window release ]; 404 [ qz_window release ];
405 qz_window = nil; 405 qz_window = nil;
406 window_view = nil; 406 window_view = nil;
407 407
408 /* Release the OpenGL context */ 408 /* Release the OpenGL context */
409 if ( mode_flags & SDL_OPENGL ) 409 if ( mode_flags & SDL_INTERNALOPENGL )
410 QZ_TearDownOpenGL (this); 410 QZ_TearDownOpenGL (this);
411 } 411 }
412 412
413 /* Signal successful teardown */ 413 /* Signal successful teardown */
414 video_set = SDL_FALSE; 414 video_set = SDL_FALSE;
510 510
511 if ( CGDisplayCanSetPalette (display_id) ) 511 if ( CGDisplayCanSetPalette (display_id) )
512 current->flags |= SDL_HWPALETTE; 512 current->flags |= SDL_HWPALETTE;
513 513
514 /* Setup OpenGL for a fullscreen context */ 514 /* Setup OpenGL for a fullscreen context */
515 if (flags & SDL_OPENGL) { 515 if (flags & SDL_INTERNALOPENGL) {
516 516
517 CGLError err; 517 CGLError err;
518 CGLContextObj ctx; 518 CGLContextObj ctx;
519 519
520 if ( ! QZ_SetupOpenGL (this, bpp, flags) ) { 520 if ( ! QZ_SetupOpenGL (this, bpp, flags) ) {
533 533
534 glClear (GL_COLOR_BUFFER_BIT); 534 glClear (GL_COLOR_BUFFER_BIT);
535 535
536 [ gl_context flushBuffer ]; 536 [ gl_context flushBuffer ];
537 537
538 current->flags |= SDL_OPENGL; 538 current->flags |= SDL_INTERNALOPENGL;
539 } 539 }
540 540
541 /* If we don't hide menu bar, it will get events and interrupt the program */ 541 /* If we don't hide menu bar, it will get events and interrupt the program */
542 HideMenuBar (); 542 HideMenuBar ();
543 543
607 CGDisplayFade (fade_token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, TRUE); 607 CGDisplayFade (fade_token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, TRUE);
608 } 608 }
609 QZ_UnsetVideoMode (this, TRUE); 609 QZ_UnsetVideoMode (this, TRUE);
610 } 610 }
611 else if ( ((mode_flags ^ flags) & (SDL_NOFRAME|SDL_RESIZABLE)) || 611 else if ( ((mode_flags ^ flags) & (SDL_NOFRAME|SDL_RESIZABLE)) ||
612 (mode_flags & SDL_OPENGL) || 612 (mode_flags & SDL_INTERNALOPENGL) ||
613 (flags & SDL_OPENGL) ) { 613 (flags & SDL_INTERNALOPENGL) ) {
614 QZ_UnsetVideoMode (this, TRUE); 614 QZ_UnsetVideoMode (this, TRUE);
615 } 615 }
616 } 616 }
617 617
618 /* Check for user-specified window and view */ 618 /* Check for user-specified window and view */
706 [ window_view setFrameSize:contentRect.size ]; 706 [ window_view setFrameSize:contentRect.size ];
707 } 707 }
708 } 708 }
709 709
710 /* For OpenGL, we bind the context to a subview */ 710 /* For OpenGL, we bind the context to a subview */
711 if ( flags & SDL_OPENGL ) { 711 if ( flags & SDL_INTERNALOPENGL ) {
712 712
713 if ( ! QZ_SetupOpenGL (this, *bpp, flags) ) { 713 if ( ! QZ_SetupOpenGL (this, *bpp, flags) ) {
714 if (fade_token != kCGDisplayFadeReservationInvalidToken) { 714 if (fade_token != kCGDisplayFadeReservationInvalidToken) {
715 CGDisplayFade (fade_token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, FALSE); 715 CGDisplayFade (fade_token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, FALSE);
716 CGReleaseDisplayFadeReservation (fade_token); 716 CGReleaseDisplayFadeReservation (fade_token);
723 [ [ qz_window contentView ] addSubview:window_view ]; 723 [ [ qz_window contentView ] addSubview:window_view ];
724 [ gl_context setView: window_view ]; 724 [ gl_context setView: window_view ];
725 [ window_view release ]; 725 [ window_view release ];
726 [ gl_context makeCurrentContext]; 726 [ gl_context makeCurrentContext];
727 [ qz_window makeKeyAndOrderFront:nil ]; 727 [ qz_window makeKeyAndOrderFront:nil ];
728 current->flags |= SDL_OPENGL; 728 current->flags |= SDL_INTERNALOPENGL;
729 } 729 }
730 /* For 2D, we set the subview to an NSQuickDrawView */ 730 /* For 2D, we set the subview to an NSQuickDrawView */
731 else { 731 else {
732 short qdbpp = 0; 732 short qdbpp = 0;
733 733