Merged in Ryan's multisample code for MacOS, and changed the constants to match.
authorSam Lantinga <slouken@libsdl.org>
Tue, 22 Jul 2003 15:33:28 +0000
changeset 656864e2d2a9a55
parent 655 9c42ee1b7d77
child 657 714053f573e7
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
WhatsNew
include/SDL_video.h
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/maccommon/SDL_macgl.c
src/video/quartz/SDL_QuartzVideo.h
src/video/quartz/SDL_QuartzVideo.m
src/video/wincommon/SDL_wingl.c
src/video/x11/SDL_x11gl.c
test/testgl.c
     1.1 --- a/WhatsNew	Tue Jul 22 15:10:06 2003 +0000
     1.2 +++ b/WhatsNew	Tue Jul 22 15:33:28 2003 +0000
     1.3 @@ -6,7 +6,7 @@
     1.4  1.2.6:
     1.5  	Added SDL_LoadObject(), SDL_LoadFunction(), and SDL_UnloadObject()
     1.6  
     1.7 -	Added SDL_GL_SAMPLE_BUFFERS and SDL_GL_SAMPLES for FSAA support
     1.8 +	Added SDL_GL_MULTISAMPLEBUFFERS and SDL_GL_MULTISAMPLESAMPLES for FSAA
     1.9  
    1.10  1.2.5:
    1.11  	Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5)
     2.1 --- a/include/SDL_video.h	Tue Jul 22 15:10:06 2003 +0000
     2.2 +++ b/include/SDL_video.h	Tue Jul 22 15:33:28 2003 +0000
     2.3 @@ -218,8 +218,8 @@
     2.4      SDL_GL_ACCUM_BLUE_SIZE,
     2.5      SDL_GL_ACCUM_ALPHA_SIZE,
     2.6      SDL_GL_STEREO,
     2.7 -    SDL_GL_SAMPLE_BUFFERS,
     2.8 -    SDL_GL_SAMPLES
     2.9 +    SDL_GL_MULTISAMPLEBUFFERS,
    2.10 +    SDL_GL_MULTISAMPLESAMPLES
    2.11  } SDL_GLattr;
    2.12  
    2.13  /* flags for SDL_SetPalette() */
     3.1 --- a/src/video/SDL_sysvideo.h	Tue Jul 22 15:10:06 2003 +0000
     3.2 +++ b/src/video/SDL_sysvideo.h	Tue Jul 22 15:33:28 2003 +0000
     3.3 @@ -304,8 +304,8 @@
     3.4  		int accum_blue_size;
     3.5  		int accum_alpha_size;
     3.6  		int stereo;
     3.7 -		int sample_buffers;
     3.8 -		int samples;
     3.9 +		int multisamplebuffers;
    3.10 +		int multisamplesamples;
    3.11  		int driver_loaded;
    3.12  		char driver_path[256];
    3.13  		void* dll_handle;
     4.1 --- a/src/video/SDL_video.c	Tue Jul 22 15:10:06 2003 +0000
     4.2 +++ b/src/video/SDL_video.c	Tue Jul 22 15:33:28 2003 +0000
     4.3 @@ -233,8 +233,8 @@
     4.4  	video->gl_config.accum_blue_size = 0;
     4.5  	video->gl_config.accum_alpha_size = 0;
     4.6  	video->gl_config.stereo = 0;
     4.7 -	video->gl_config.sample_buffers = 0;
     4.8 -	video->gl_config.samples = 0;
     4.9 +	video->gl_config.multisamplebuffers = 0;
    4.10 +	video->gl_config.multisamplesamples = 0;
    4.11  	
    4.12  	/* Initialize the video subsystem */
    4.13  	memset(&vformat, 0, sizeof(vformat));
    4.14 @@ -1422,11 +1422,11 @@
    4.15  		case SDL_GL_STEREO:
    4.16  			video->gl_config.stereo = value;
    4.17  			break;
    4.18 -		case SDL_GL_SAMPLE_BUFFERS:
    4.19 -			video->gl_config.sample_buffers = value;
    4.20 +		case SDL_GL_MULTISAMPLEBUFFERS:
    4.21 +			video->gl_config.multisamplebuffers = value;
    4.22  			break;
    4.23 -		case SDL_GL_SAMPLES:
    4.24 -			video->gl_config.samples = value;
    4.25 +		case SDL_GL_MULTISAMPLESAMPLES:
    4.26 +			video->gl_config.multisamplesamples = value;
    4.27  			break;
    4.28  		default:
    4.29  			SDL_SetError("Unknown OpenGL attribute");
     5.1 --- a/src/video/maccommon/SDL_macgl.c	Tue Jul 22 15:10:06 2003 +0000
     5.2 +++ b/src/video/maccommon/SDL_macgl.c	Tue Jul 22 15:33:28 2003 +0000
     5.3 @@ -49,6 +49,14 @@
     5.4  	if ( this->gl_config.stereo ) {
     5.5  		attributes[i++] = AGL_STEREO;
     5.6  	}
     5.7 +	if ( this->gl_config.multisamplebuffers != 0 ) {
     5.8 +		attributes[i++] = AGL_SAMPLE_BUFFERS_ARB;
     5.9 +		attributes[i++] = this->gl_config.multisamplebuffers;
    5.10 +	}	
    5.11 +	if ( this->gl_config.multisamplesamples != 0 ) {
    5.12 +		attributes[i++] = AGL_SAMPLES_ARB;
    5.13 +		attributes[i++] = this->gl_config.multisamplesamples;
    5.14 +	}	
    5.15  	if ( this->gl_config.depth_size != 0 ) {
    5.16  		attributes[i++] = AGL_DEPTH_SIZE;
    5.17  		attributes[i++] = this->gl_config.depth_size;
     6.1 --- a/src/video/quartz/SDL_QuartzVideo.h	Tue Jul 22 15:10:06 2003 +0000
     6.2 +++ b/src/video/quartz/SDL_QuartzVideo.h	Tue Jul 22 15:33:28 2003 +0000
     6.3 @@ -50,6 +50,8 @@
     6.4  
     6.5  #include <Cocoa/Cocoa.h>
     6.6  #include <OpenGL/OpenGL.h>
     6.7 +#include <OpenGL/gl.h>
     6.8 +#include <OpenGL/glext.h>
     6.9  #include <Carbon/Carbon.h>
    6.10  #include <QuickTime/QuickTime.h>
    6.11  #include <IOKit/IOKitLib.h>	/* For powersave handling */
     7.1 --- a/src/video/quartz/SDL_QuartzVideo.m	Tue Jul 22 15:10:06 2003 +0000
     7.2 +++ b/src/video/quartz/SDL_QuartzVideo.m	Tue Jul 22 15:33:28 2003 +0000
     7.3 @@ -1419,6 +1419,16 @@
     7.4          attr[i++] = this->gl_config.stencil_size;
     7.5      }
     7.6  
     7.7 +    if ( this->gl_config.multisamplebuffers != 0 ) {
     7.8 +        attr[i++] = NSOpenGLPFASampleBuffers;
     7.9 +        attr[i++] = this->gl_config.multisamplebuffers;
    7.10 +    }
    7.11 +
    7.12 +    if ( this->gl_config.multisamplesamples != 0 ) {
    7.13 +        attr[i++] = NSOpenGLPFASamples;
    7.14 +        attr[i++] = this->gl_config.multisamplesamples;
    7.15 +    }
    7.16 +
    7.17      attr[i++] = NSOpenGLPFAScreenMask;
    7.18      attr[i++] = CGDisplayIDToOpenGLDisplayMask (display_id);
    7.19      attr[i] = 0;
    7.20 @@ -1503,6 +1513,8 @@
    7.21          case SDL_GL_ACCUM_BLUE_SIZE: attr = GL_ACCUM_BLUE_BITS; break;
    7.22          case SDL_GL_ACCUM_ALPHA_SIZE: attr = GL_ACCUM_ALPHA_BITS; break;
    7.23          case SDL_GL_STEREO: attr = GL_STEREO; break;
    7.24 +        case SDL_GL_MULTISAMPLEBUFFERS: attr = GL_SAMPLE_BUFFERS_ARB; break;
    7.25 +        case SDL_GL_MULTISAMPLESAMPLES: attr = GL_SAMPLES_ARB; break;
    7.26          case SDL_GL_BUFFER_SIZE:
    7.27          {
    7.28              GLint bits = 0;
     8.1 --- a/src/video/wincommon/SDL_wingl.c	Tue Jul 22 15:10:06 2003 +0000
     8.2 +++ b/src/video/wincommon/SDL_wingl.c	Tue Jul 22 15:33:28 2003 +0000
     8.3 @@ -237,14 +237,14 @@
     8.4  			*iAttr++ = this->gl_config.stereo;
     8.5  		}
     8.6  
     8.7 -		if ( this->gl_config.sample_buffers ) {
     8.8 +		if ( this->gl_config.multisamplebuffers ) {
     8.9  			*iAttr++ = WGL_SAMPLE_BUFFERS_ARB;
    8.10 -			*iAttr++ = this->gl_config.sample_buffers;
    8.11 +			*iAttr++ = this->gl_config.multisamplebuffers;
    8.12  		}
    8.13  
    8.14 -		if ( this->gl_config.samples ) {
    8.15 +		if ( this->gl_config.multisamplesamples ) {
    8.16  			*iAttr++ = WGL_SAMPLES_ARB;
    8.17 -			*iAttr++ = this->gl_config.samples;
    8.18 +			*iAttr++ = this->gl_config.multisamplesamples;
    8.19  		}
    8.20  
    8.21  		*iAttr = 0;
    8.22 @@ -375,10 +375,10 @@
    8.23  		    case SDL_GL_STEREO:
    8.24  			wgl_attrib = WGL_STEREO_ARB;
    8.25  			break;
    8.26 -		    case SDL_GL_SAMPLE_BUFFERS:
    8.27 +		    case SDL_GL_MULTISAMPLEBUFFERS:
    8.28  			wgl_attrib = WGL_SAMPLE_BUFFERS_ARB;
    8.29  			break;
    8.30 -		    case SDL_GL_SAMPLES:
    8.31 +		    case SDL_GL_MULTISAMPLESAMPLES:
    8.32  			wgl_attrib = WGL_SAMPLES_ARB;
    8.33  			break;
    8.34  		    default:
     9.1 --- a/src/video/x11/SDL_x11gl.c	Tue Jul 22 15:10:06 2003 +0000
     9.2 +++ b/src/video/x11/SDL_x11gl.c	Tue Jul 22 15:33:28 2003 +0000
     9.3 @@ -123,14 +123,14 @@
     9.4  		attribs[i++] = this->gl_config.stereo;
     9.5  	}
     9.6  	
     9.7 -	if( this->gl_config.sample_buffers ) {
     9.8 +	if( this->gl_config.multisamplebuffers ) {
     9.9  		attribs[i++] = GLX_SAMPLE_BUFFERS_ARB;
    9.10 -		attribs[i++] = this->gl_config.sample_buffers;
    9.11 +		attribs[i++] = this->gl_config.multisamplebuffers;
    9.12  	}
    9.13  	
    9.14 -	if( this->gl_config.samples ) {
    9.15 +	if( this->gl_config.multisamplesamples ) {
    9.16  		attribs[i++] = GLX_SAMPLES_ARB;
    9.17 -		attribs[i++] = this->gl_config.samples;
    9.18 +		attribs[i++] = this->gl_config.multisamplesamples;
    9.19  	}
    9.20  
    9.21  #ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */
    9.22 @@ -362,10 +362,10 @@
    9.23  	    case SDL_GL_STEREO:
    9.24  		glx_attrib = GLX_STEREO;
    9.25  		break;
    9.26 - 	    case SDL_GL_SAMPLE_BUFFERS:
    9.27 + 	    case SDL_GL_MULTISAMPLEBUFFERS:
    9.28   		glx_attrib = GLX_SAMPLE_BUFFERS_ARB;
    9.29   		break;
    9.30 - 	    case SDL_GL_SAMPLES:
    9.31 + 	    case SDL_GL_MULTISAMPLESAMPLES:
    9.32   		glx_attrib = GLX_SAMPLES_ARB;
    9.33   		break;
    9.34  	    default:
    10.1 --- a/test/testgl.c	Tue Jul 22 15:10:06 2003 +0000
    10.2 +++ b/test/testgl.c	Tue Jul 22 15:33:28 2003 +0000
    10.3 @@ -476,8 +476,8 @@
    10.4  	SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
    10.5  	SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
    10.6  	if ( fsaa ) {
    10.7 -		SDL_GL_SetAttribute( SDL_GL_SAMPLE_BUFFERS, 1 );
    10.8 -		SDL_GL_SetAttribute( SDL_GL_SAMPLES, fsaa );
    10.9 +		SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
   10.10 +		SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa );
   10.11  	}
   10.12  	if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) {
   10.13  		fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
   10.14 @@ -504,10 +504,10 @@
   10.15  	SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &value );
   10.16  	printf( "SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value );
   10.17  	if ( fsaa ) {
   10.18 -		SDL_GL_GetAttribute( SDL_GL_SAMPLE_BUFFERS, &value );
   10.19 -		printf( "SDL_GL_SAMPLE_BUFFERS: requested 1, got %d\n", value );
   10.20 -		SDL_GL_GetAttribute( SDL_GL_SAMPLES, &value );
   10.21 -		printf( "SDL_GL_SAMPLES: requested %d, got %d\n", fsaa, value );
   10.22 +		SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &value );
   10.23 +		printf( "SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value );
   10.24 +		SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &value );
   10.25 +		printf( "SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value );
   10.26  	}
   10.27  
   10.28  	/* Set the window manager title bar */