diff test/testgl.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 c59692dcdce0
children 864e2d2a9a55
line wrap: on
line diff
--- a/test/testgl.c	Tue Jul 22 14:01:21 2003 +0000
+++ b/test/testgl.c	Tue Jul 22 15:10:06 2003 +0000
@@ -393,7 +393,7 @@
 }
 
 int RunGLTest( int argc, char* argv[],
-               int logo, int slowly, int bpp, float gamma, int noframe )
+               int logo, int slowly, int bpp, float gamma, int noframe, int fsaa )
 {
 	int i;
 	int rgb_size[3];
@@ -475,6 +475,10 @@
 	SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, rgb_size[2] );
 	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 );
+	}
 	if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) {
 		fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
 		SDL_Quit();
@@ -499,6 +503,12 @@
 	printf( "SDL_GL_DEPTH_SIZE: requested %d, got %d\n", bpp, value );
 	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 );
+	}
 
 	/* Set the window manager title bar */
 	SDL_WM_SetCaption( "SDL GL test", "testgl" );
@@ -700,6 +710,7 @@
 	int slowly;
 	float gamma = 0.0;
 	int noframe = 0;
+	int fsaa = 0;
 
 	logo = 0;
 	slowly = 0;
@@ -728,15 +739,18 @@
 		if ( strcmp(argv[i], "-noframe") == 0 ) {
  		       noframe = 1;
 		}
+		if ( strcmp(argv[i], "-fsaa") == 0 ) {
+ 		       ++fsaa;
+		}
 		if ( strncmp(argv[i], "-h", 2) == 0 ) {
  		       printf(
-"Usage: %s [-twice] [-logo] [-slow] [-bpp n] [-gamma n] [-noframe]\n",
+"Usage: %s [-twice] [-logo] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa]\n",
  			      argv[0]);
 			exit(0);
 		}
 	}
 	for ( i=0; i<numtests; ++i ) {
- 		RunGLTest(argc, argv, logo, slowly, bpp, gamma, noframe);
+ 		RunGLTest(argc, argv, logo, slowly, bpp, gamma, noframe, fsaa);
 	}
 	return 0;
 }