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 656 864e2d2a9a55
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
--- a/WhatsNew	Tue Jul 22 15:10:06 2003 +0000
+++ b/WhatsNew	Tue Jul 22 15:33:28 2003 +0000
@@ -6,7 +6,7 @@
 1.2.6:
 	Added SDL_LoadObject(), SDL_LoadFunction(), and SDL_UnloadObject()
 
-	Added SDL_GL_SAMPLE_BUFFERS and SDL_GL_SAMPLES for FSAA support
+	Added SDL_GL_MULTISAMPLEBUFFERS and SDL_GL_MULTISAMPLESAMPLES for FSAA
 
 1.2.5:
 	Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5)
--- a/include/SDL_video.h	Tue Jul 22 15:10:06 2003 +0000
+++ b/include/SDL_video.h	Tue Jul 22 15:33:28 2003 +0000
@@ -218,8 +218,8 @@
     SDL_GL_ACCUM_BLUE_SIZE,
     SDL_GL_ACCUM_ALPHA_SIZE,
     SDL_GL_STEREO,
-    SDL_GL_SAMPLE_BUFFERS,
-    SDL_GL_SAMPLES
+    SDL_GL_MULTISAMPLEBUFFERS,
+    SDL_GL_MULTISAMPLESAMPLES
 } SDL_GLattr;
 
 /* flags for SDL_SetPalette() */
--- a/src/video/SDL_sysvideo.h	Tue Jul 22 15:10:06 2003 +0000
+++ b/src/video/SDL_sysvideo.h	Tue Jul 22 15:33:28 2003 +0000
@@ -304,8 +304,8 @@
 		int accum_blue_size;
 		int accum_alpha_size;
 		int stereo;
-		int sample_buffers;
-		int samples;
+		int multisamplebuffers;
+		int multisamplesamples;
 		int driver_loaded;
 		char driver_path[256];
 		void* dll_handle;
--- a/src/video/SDL_video.c	Tue Jul 22 15:10:06 2003 +0000
+++ b/src/video/SDL_video.c	Tue Jul 22 15:33:28 2003 +0000
@@ -233,8 +233,8 @@
 	video->gl_config.accum_blue_size = 0;
 	video->gl_config.accum_alpha_size = 0;
 	video->gl_config.stereo = 0;
-	video->gl_config.sample_buffers = 0;
-	video->gl_config.samples = 0;
+	video->gl_config.multisamplebuffers = 0;
+	video->gl_config.multisamplesamples = 0;
 	
 	/* Initialize the video subsystem */
 	memset(&vformat, 0, sizeof(vformat));
@@ -1422,11 +1422,11 @@
 		case SDL_GL_STEREO:
 			video->gl_config.stereo = value;
 			break;
-		case SDL_GL_SAMPLE_BUFFERS:
-			video->gl_config.sample_buffers = value;
+		case SDL_GL_MULTISAMPLEBUFFERS:
+			video->gl_config.multisamplebuffers = value;
 			break;
-		case SDL_GL_SAMPLES:
-			video->gl_config.samples = value;
+		case SDL_GL_MULTISAMPLESAMPLES:
+			video->gl_config.multisamplesamples = value;
 			break;
 		default:
 			SDL_SetError("Unknown OpenGL attribute");
--- a/src/video/maccommon/SDL_macgl.c	Tue Jul 22 15:10:06 2003 +0000
+++ b/src/video/maccommon/SDL_macgl.c	Tue Jul 22 15:33:28 2003 +0000
@@ -49,6 +49,14 @@
 	if ( this->gl_config.stereo ) {
 		attributes[i++] = AGL_STEREO;
 	}
+	if ( this->gl_config.multisamplebuffers != 0 ) {
+		attributes[i++] = AGL_SAMPLE_BUFFERS_ARB;
+		attributes[i++] = this->gl_config.multisamplebuffers;
+	}	
+	if ( this->gl_config.multisamplesamples != 0 ) {
+		attributes[i++] = AGL_SAMPLES_ARB;
+		attributes[i++] = this->gl_config.multisamplesamples;
+	}	
 	if ( this->gl_config.depth_size != 0 ) {
 		attributes[i++] = AGL_DEPTH_SIZE;
 		attributes[i++] = this->gl_config.depth_size;
--- a/src/video/quartz/SDL_QuartzVideo.h	Tue Jul 22 15:10:06 2003 +0000
+++ b/src/video/quartz/SDL_QuartzVideo.h	Tue Jul 22 15:33:28 2003 +0000
@@ -50,6 +50,8 @@
 
 #include <Cocoa/Cocoa.h>
 #include <OpenGL/OpenGL.h>
+#include <OpenGL/gl.h>
+#include <OpenGL/glext.h>
 #include <Carbon/Carbon.h>
 #include <QuickTime/QuickTime.h>
 #include <IOKit/IOKitLib.h>	/* For powersave handling */
--- a/src/video/quartz/SDL_QuartzVideo.m	Tue Jul 22 15:10:06 2003 +0000
+++ b/src/video/quartz/SDL_QuartzVideo.m	Tue Jul 22 15:33:28 2003 +0000
@@ -1419,6 +1419,16 @@
         attr[i++] = this->gl_config.stencil_size;
     }
 
+    if ( this->gl_config.multisamplebuffers != 0 ) {
+        attr[i++] = NSOpenGLPFASampleBuffers;
+        attr[i++] = this->gl_config.multisamplebuffers;
+    }
+
+    if ( this->gl_config.multisamplesamples != 0 ) {
+        attr[i++] = NSOpenGLPFASamples;
+        attr[i++] = this->gl_config.multisamplesamples;
+    }
+
     attr[i++] = NSOpenGLPFAScreenMask;
     attr[i++] = CGDisplayIDToOpenGLDisplayMask (display_id);
     attr[i] = 0;
@@ -1503,6 +1513,8 @@
         case SDL_GL_ACCUM_BLUE_SIZE: attr = GL_ACCUM_BLUE_BITS; break;
         case SDL_GL_ACCUM_ALPHA_SIZE: attr = GL_ACCUM_ALPHA_BITS; break;
         case SDL_GL_STEREO: attr = GL_STEREO; break;
+        case SDL_GL_MULTISAMPLEBUFFERS: attr = GL_SAMPLE_BUFFERS_ARB; break;
+        case SDL_GL_MULTISAMPLESAMPLES: attr = GL_SAMPLES_ARB; break;
         case SDL_GL_BUFFER_SIZE:
         {
             GLint bits = 0;
--- a/src/video/wincommon/SDL_wingl.c	Tue Jul 22 15:10:06 2003 +0000
+++ b/src/video/wincommon/SDL_wingl.c	Tue Jul 22 15:33:28 2003 +0000
@@ -237,14 +237,14 @@
 			*iAttr++ = this->gl_config.stereo;
 		}
 
-		if ( this->gl_config.sample_buffers ) {
+		if ( this->gl_config.multisamplebuffers ) {
 			*iAttr++ = WGL_SAMPLE_BUFFERS_ARB;
-			*iAttr++ = this->gl_config.sample_buffers;
+			*iAttr++ = this->gl_config.multisamplebuffers;
 		}
 
-		if ( this->gl_config.samples ) {
+		if ( this->gl_config.multisamplesamples ) {
 			*iAttr++ = WGL_SAMPLES_ARB;
-			*iAttr++ = this->gl_config.samples;
+			*iAttr++ = this->gl_config.multisamplesamples;
 		}
 
 		*iAttr = 0;
@@ -375,10 +375,10 @@
 		    case SDL_GL_STEREO:
 			wgl_attrib = WGL_STEREO_ARB;
 			break;
-		    case SDL_GL_SAMPLE_BUFFERS:
+		    case SDL_GL_MULTISAMPLEBUFFERS:
 			wgl_attrib = WGL_SAMPLE_BUFFERS_ARB;
 			break;
-		    case SDL_GL_SAMPLES:
+		    case SDL_GL_MULTISAMPLESAMPLES:
 			wgl_attrib = WGL_SAMPLES_ARB;
 			break;
 		    default:
--- a/src/video/x11/SDL_x11gl.c	Tue Jul 22 15:10:06 2003 +0000
+++ b/src/video/x11/SDL_x11gl.c	Tue Jul 22 15:33:28 2003 +0000
@@ -123,14 +123,14 @@
 		attribs[i++] = this->gl_config.stereo;
 	}
 	
-	if( this->gl_config.sample_buffers ) {
+	if( this->gl_config.multisamplebuffers ) {
 		attribs[i++] = GLX_SAMPLE_BUFFERS_ARB;
-		attribs[i++] = this->gl_config.sample_buffers;
+		attribs[i++] = this->gl_config.multisamplebuffers;
 	}
 	
-	if( this->gl_config.samples ) {
+	if( this->gl_config.multisamplesamples ) {
 		attribs[i++] = GLX_SAMPLES_ARB;
-		attribs[i++] = this->gl_config.samples;
+		attribs[i++] = this->gl_config.multisamplesamples;
 	}
 
 #ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */
@@ -362,10 +362,10 @@
 	    case SDL_GL_STEREO:
 		glx_attrib = GLX_STEREO;
 		break;
- 	    case SDL_GL_SAMPLE_BUFFERS:
+ 	    case SDL_GL_MULTISAMPLEBUFFERS:
  		glx_attrib = GLX_SAMPLE_BUFFERS_ARB;
  		break;
- 	    case SDL_GL_SAMPLES:
+ 	    case SDL_GL_MULTISAMPLESAMPLES:
  		glx_attrib = GLX_SAMPLES_ARB;
  		break;
 	    default:
--- a/test/testgl.c	Tue Jul 22 15:10:06 2003 +0000
+++ b/test/testgl.c	Tue Jul 22 15:33:28 2003 +0000
@@ -476,8 +476,8 @@
 	SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
 	SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
 	if ( fsaa ) {
-		SDL_GL_SetAttribute( SDL_GL_SAMPLE_BUFFERS, 1 );
-		SDL_GL_SetAttribute( SDL_GL_SAMPLES, fsaa );
+		SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
+		SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa );
 	}
 	if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) {
 		fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
@@ -504,10 +504,10 @@
 	SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &value );
 	printf( "SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value );
 	if ( fsaa ) {
-		SDL_GL_GetAttribute( SDL_GL_SAMPLE_BUFFERS, &value );
-		printf( "SDL_GL_SAMPLE_BUFFERS: requested 1, got %d\n", value );
-		SDL_GL_GetAttribute( SDL_GL_SAMPLES, &value );
-		printf( "SDL_GL_SAMPLES: requested %d, got %d\n", fsaa, value );
+		SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &value );
+		printf( "SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value );
+		SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &value );
+		printf( "SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value );
 	}
 
 	/* Set the window manager title bar */