diff src/video/x11/SDL_x11gl.c @ 655:9c42ee1b7d77

Date: Thu, 24 Apr 2003 15:13:47 -0400 From: Shawn Kirst Subject: SDL-1.2.5 patch to add ARB_multisample support Attached is a patch I have written for SDL-1.2.5 that adds ARB_multisample support. I only have the X11 and Win32 video patched. The Win32 patch also adds support for WGL_ARB_pixel_format, as it was required for getting a multisample capable pixel format. No additional GL header files are required to compile on either platform (though you need an up-to-date glx.h for X11). Requesting a multisample pixel format is made possible using SDL_GL_SetAttribute with the two new SDL_GLattr's I've added (SDL_GL_SAMPLE_BUFFERS and SDL_GL_SAMPLES). I've been using SDL in my projects for quite a while now, so I am happy to contribute back to the project. Now you can have and control FSAA in your SDL/GL apps at the application level!
author Sam Lantinga <slouken@libsdl.org>
date Tue, 22 Jul 2003 15:10:06 +0000
parents 0f2029a70548
children 864e2d2a9a55
line wrap: on
line diff
--- a/src/video/x11/SDL_x11gl.c	Tue Jul 22 14:01:21 2003 +0000
+++ b/src/video/x11/SDL_x11gl.c	Tue Jul 22 15:10:06 2003 +0000
@@ -122,6 +122,16 @@
 		attribs[i++] = GLX_STEREO;
 		attribs[i++] = this->gl_config.stereo;
 	}
+	
+	if( this->gl_config.sample_buffers ) {
+		attribs[i++] = GLX_SAMPLE_BUFFERS_ARB;
+		attribs[i++] = this->gl_config.sample_buffers;
+	}
+	
+	if( this->gl_config.samples ) {
+		attribs[i++] = GLX_SAMPLES_ARB;
+		attribs[i++] = this->gl_config.samples;
+	}
 
 #ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */
 	attribs[i++] = GLX_X_VISUAL_TYPE;
@@ -229,7 +239,7 @@
 
 #ifdef HAVE_OPENGL
 
-static int ExtensionSupported(const char *extension, const char *all_extensions)
+static int ExtensionSupported(const char *extension)
 {
 	const GLubyte *extensions = NULL;
 	const GLubyte *start;
@@ -266,7 +276,6 @@
 int X11_GL_MakeCurrent(_THIS)
 {
 	int retval;
-	const char *glx_extensions;
 	
 	retval = 0;
 	if ( ! this->gl_data->glXMakeCurrent(GFX_Display,
@@ -276,7 +285,6 @@
 	}
 	XSync( GFX_Display, False );
 
-	
 	/* 
 	 * The context is now current, check for glXReleaseBuffersMESA() 
 	 * extension. If extension is _not_ supported, destroy the pointer 
@@ -296,10 +304,10 @@
 	 * 
 	 */
 	
-	glx_extensions = this->gl_data->glXQueryExtensionsString(GFX_Display, SDL_Screen);
-	if (!ExtensionSupported("glXReleaseBuffersMESA", glx_extensions)) this->gl_data->glXReleaseBuffersMESA = NULL;
-	
-	
+	if ( ! ExtensionSupported("glXReleaseBuffersMESA") ) {
+		this->gl_data->glXReleaseBuffersMESA = NULL;
+	}
+
 	/* More Voodoo X server workarounds... Grr... */
 	SDL_Lock_EventThread();
 	X11_CheckDGAMouse(this);
@@ -354,6 +362,12 @@
 	    case SDL_GL_STEREO:
 		glx_attrib = GLX_STEREO;
 		break;
+ 	    case SDL_GL_SAMPLE_BUFFERS:
+ 		glx_attrib = GLX_SAMPLE_BUFFERS_ARB;
+ 		break;
+ 	    case SDL_GL_SAMPLES:
+ 		glx_attrib = GLX_SAMPLES_ARB;
+ 		break;
 	    default:
 		return(-1);
 	}