1.1 --- a/WhatsNew Tue Jul 22 14:01:21 2003 +0000
1.2 +++ b/WhatsNew Tue Jul 22 15:10:06 2003 +0000
1.3 @@ -6,6 +6,8 @@
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 +
1.9 1.2.5:
1.10 Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5)
1.11
2.1 --- a/include/SDL_video.h Tue Jul 22 14:01:21 2003 +0000
2.2 +++ b/include/SDL_video.h Tue Jul 22 15:10:06 2003 +0000
2.3 @@ -217,7 +217,9 @@
2.4 SDL_GL_ACCUM_GREEN_SIZE,
2.5 SDL_GL_ACCUM_BLUE_SIZE,
2.6 SDL_GL_ACCUM_ALPHA_SIZE,
2.7 - SDL_GL_STEREO
2.8 + SDL_GL_STEREO,
2.9 + SDL_GL_SAMPLE_BUFFERS,
2.10 + SDL_GL_SAMPLES
2.11 } SDL_GLattr;
2.12
2.13 /* flags for SDL_SetPalette() */
3.1 --- a/src/video/SDL_sysvideo.h Tue Jul 22 14:01:21 2003 +0000
3.2 +++ b/src/video/SDL_sysvideo.h Tue Jul 22 15:10:06 2003 +0000
3.3 @@ -304,6 +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 driver_loaded;
3.10 char driver_path[256];
3.11 void* dll_handle;
4.1 --- a/src/video/SDL_video.c Tue Jul 22 14:01:21 2003 +0000
4.2 +++ b/src/video/SDL_video.c Tue Jul 22 15:10:06 2003 +0000
4.3 @@ -233,6 +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
4.10 /* Initialize the video subsystem */
4.11 memset(&vformat, 0, sizeof(vformat));
4.12 @@ -1420,6 +1422,12 @@
4.13 case SDL_GL_STEREO:
4.14 video->gl_config.stereo = value;
4.15 break;
4.16 + case SDL_GL_SAMPLE_BUFFERS:
4.17 + video->gl_config.sample_buffers = value;
4.18 + break;
4.19 + case SDL_GL_SAMPLES:
4.20 + video->gl_config.samples = value;
4.21 + break;
4.22 default:
4.23 SDL_SetError("Unknown OpenGL attribute");
4.24 retval = -1;
5.1 --- a/src/video/wincommon/SDL_wingl.c Tue Jul 22 14:01:21 2003 +0000
5.2 +++ b/src/video/wincommon/SDL_wingl.c Tue Jul 22 15:10:06 2003 +0000
5.3 @@ -25,6 +25,8 @@
5.4 "@(#) $Id$";
5.5 #endif
5.6
5.7 +#include <string.h>
5.8 +
5.9 /* WGL implementation of SDL OpenGL support */
5.10
5.11 #ifdef HAVE_OPENGL
5.12 @@ -77,12 +79,60 @@
5.13 return(status);
5.14 }
5.15
5.16 +static int Init_WGL_ARB_extensions(_THIS)
5.17 +{
5.18 + HWND hwnd;
5.19 + HDC hdc;
5.20 + HGLRC hglrc;
5.21 + int pformat;
5.22 + const char * (WINAPI *wglGetExtensionsStringARB)(HDC) = 0;
5.23 +
5.24 + hwnd = CreateWindow(NULL, "PFormat", WS_POPUP | WS_DISABLED,
5.25 + 0, 0, 10, 10,
5.26 + NULL, NULL, SDL_Instance,NULL);
5.27 + hdc = GetDC(hwnd);
5.28 +
5.29 + pformat = ChoosePixelFormat(hdc, &GL_pfd);
5.30 + SetPixelFormat(hdc, pformat, &GL_pfd);
5.31 +
5.32 + hglrc = this->gl_data->wglCreateContext(hdc);
5.33 + this->gl_data->wglMakeCurrent(hdc, hglrc);
5.34 +
5.35 + wglGetExtensionsStringARB = (const char * (WINAPI *)(HDC))
5.36 + this->gl_data->wglGetProcAddress("wglGetExtensionsStringARB");
5.37 +
5.38 + if(wglGetExtensionsStringARB && strstr(wglGetExtensionsStringARB(hdc),"WGL_ARB_pixel_format")) {
5.39 + this->gl_data->wglChoosePixelFormatARB =
5.40 + (BOOL (WINAPI *)(HDC, const int *, const FLOAT *, UINT, int *, UINT *))
5.41 + this->gl_data->wglGetProcAddress("wglChoosePixelFormatARB");
5.42 + this->gl_data->wglGetPixelFormatAttribivARB =
5.43 + (BOOL (WINAPI *)(HDC, int, int, UINT, const int *, int *))
5.44 + this->gl_data->wglGetProcAddress("wglGetPixelFormatAttribivARB");
5.45 +
5.46 + if( (this->gl_data->wglChoosePixelFormatARB != NULL) &&
5.47 + (this->gl_data->wglGetPixelFormatAttribivARB != NULL) )
5.48 + this->gl_data->wgl_arb_pixel_format = 1;
5.49 + else
5.50 + this->gl_data->wgl_arb_pixel_format = 0;
5.51 + } else {
5.52 + this->gl_data->wgl_arb_pixel_format = 0;
5.53 + }
5.54 +
5.55 + this->gl_data->wglMakeCurrent(NULL, NULL);
5.56 + this->gl_data->wglDeleteContext(hglrc);
5.57 + ReleaseDC(hwnd, hdc);
5.58 + DestroyWindow(hwnd);
5.59 +}
5.60 +
5.61 int WIN_GL_SetupWindow(_THIS)
5.62 {
5.63 int retval;
5.64 #ifdef HAVE_OPENGL
5.65 int i;
5.66 - int pixel_format;
5.67 + unsigned int matching;
5.68 + int iAttribs[64];
5.69 + int *iAttr;
5.70 + float fAttribs[1] = { 0 };
5.71
5.72 /* load the gl driver from a default path */
5.73 if ( ! this->gl_config.driver_loaded ) {
5.74 @@ -127,13 +177,90 @@
5.75 GL_pfd.cDepthBits = this->gl_config.depth_size;
5.76 GL_pfd.cStencilBits = this->gl_config.stencil_size;
5.77
5.78 + /* initialize WGL_ARB_pixel_format */
5.79 + Init_WGL_ARB_extensions(this);
5.80 +
5.81 + /* setup WGL_ARB_pixel_format attribs */
5.82 + iAttr = &iAttribs[0];
5.83 +
5.84 + *iAttr++ = WGL_DRAW_TO_WINDOW_ARB;
5.85 + *iAttr++ = GL_TRUE;
5.86 + *iAttr++ = WGL_ACCELERATION_ARB;
5.87 + *iAttr++ = WGL_FULL_ACCELERATION_ARB;
5.88 + *iAttr++ = WGL_RED_BITS_ARB;
5.89 + *iAttr++ = this->gl_config.red_size;
5.90 + *iAttr++ = WGL_GREEN_BITS_ARB;
5.91 + *iAttr++ = this->gl_config.green_size;
5.92 + *iAttr++ = WGL_BLUE_BITS_ARB;
5.93 + *iAttr++ = this->gl_config.blue_size;
5.94 +
5.95 + if ( this->gl_config.alpha_size ) {
5.96 + *iAttr++ = WGL_ALPHA_BITS_ARB;
5.97 + *iAttr++ = this->gl_config.alpha_size;
5.98 + }
5.99 +
5.100 + if ( this->gl_config.double_buffer ) {
5.101 + *iAttr ++ = WGL_DOUBLE_BUFFER_ARB;
5.102 + *iAttr ++ = GL_TRUE;
5.103 + }
5.104 +
5.105 + *iAttr++ = WGL_DEPTH_BITS_ARB;
5.106 + *iAttr++ = this->gl_config.depth_size;
5.107 +
5.108 + if ( this->gl_config.stencil_size ) {
5.109 + *iAttr++ = WGL_STENCIL_BITS_ARB;
5.110 + *iAttr++ = this->gl_config.stencil_size;
5.111 + }
5.112 +
5.113 + if ( this->gl_config.accum_red_size ) {
5.114 + *iAttr++ = WGL_ACCUM_RED_BITS_ARB;
5.115 + *iAttr++ = this->gl_config.accum_red_size;
5.116 + }
5.117 +
5.118 + if ( this->gl_config.accum_green_size ) {
5.119 + *iAttr++ = WGL_ACCUM_GREEN_BITS_ARB;
5.120 + *iAttr++ = this->gl_config.accum_green_size;
5.121 + }
5.122 +
5.123 + if ( this->gl_config.accum_blue_size ) {
5.124 + *iAttr++ = WGL_ACCUM_BLUE_BITS_ARB;
5.125 + *iAttr++ = this->gl_config.accum_blue_size;
5.126 + }
5.127 +
5.128 + if ( this->gl_config.accum_alpha_size ) {
5.129 + *iAttr++ = WGL_ACCUM_ALPHA_BITS_ARB;
5.130 + *iAttr++ = this->gl_config.accum_alpha_size;
5.131 + }
5.132 +
5.133 + if ( this->gl_config.stereo ) {
5.134 + *iAttr++ = WGL_STEREO_ARB;
5.135 + *iAttr++ = this->gl_config.stereo;
5.136 + }
5.137 +
5.138 + if ( this->gl_config.sample_buffers ) {
5.139 + *iAttr++ = WGL_SAMPLE_BUFFERS_ARB;
5.140 + *iAttr++ = this->gl_config.sample_buffers;
5.141 + }
5.142 +
5.143 + if ( this->gl_config.samples ) {
5.144 + *iAttr++ = WGL_SAMPLES_ARB;
5.145 + *iAttr++ = this->gl_config.samples;
5.146 + }
5.147 +
5.148 + *iAttr = 0;
5.149 +
5.150 /* Choose and set the closest available pixel format */
5.151 - pixel_format = ChoosePixelFormat(GL_hdc, &GL_pfd);
5.152 + if ( !this->gl_data->wgl_arb_pixel_format ||
5.153 + !this->gl_data->wglChoosePixelFormatARB(GL_hdc, iAttribs, fAttribs, 1, &pixel_format, &matching) ||
5.154 + !matching ) {
5.155 + pixel_format = ChoosePixelFormat(GL_hdc, &GL_pfd);
5.156 + this->gl_data->wgl_arb_pixel_format = 0;
5.157 + }
5.158 if ( !pixel_format ) {
5.159 SDL_SetError("No matching GL pixel format available");
5.160 return(-1);
5.161 }
5.162 - if( !SetPixelFormat(GL_hdc, pixel_format, &GL_pfd) ) {
5.163 + if ( !SetPixelFormat(GL_hdc, pixel_format, &GL_pfd) ) {
5.164 if ( i == 0 ) {
5.165 /* First time through, try resetting the window */
5.166 if ( WIN_GL_ResetWindow(this) < 0 ) {
5.167 @@ -150,7 +277,7 @@
5.168 DescribePixelFormat(GL_hdc, pixel_format, sizeof(GL_pfd), &GL_pfd);
5.169
5.170 GL_hrc = this->gl_data->wglCreateContext(GL_hdc);
5.171 - if( GL_hrc == NULL ) {
5.172 + if ( GL_hrc == NULL ) {
5.173 SDL_SetError("Unable to create GL context");
5.174 return(-1);
5.175 }
5.176 @@ -204,9 +331,66 @@
5.177 int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
5.178 {
5.179 int retval;
5.180 +
5.181 + if ( this->gl_data->wgl_arb_pixel_format ) {
5.182 + int wgl_attrib;
5.183 +
5.184 + switch(attrib) {
5.185 + case SDL_GL_RED_SIZE:
5.186 + wgl_attrib = WGL_RED_BITS_ARB;
5.187 + break;
5.188 + case SDL_GL_GREEN_SIZE:
5.189 + wgl_attrib = WGL_GREEN_BITS_ARB;
5.190 + break;
5.191 + case SDL_GL_BLUE_SIZE:
5.192 + wgl_attrib = WGL_BLUE_BITS_ARB;
5.193 + break;
5.194 + case SDL_GL_ALPHA_SIZE:
5.195 + wgl_attrib = WGL_ALPHA_BITS_ARB;
5.196 + break;
5.197 + case SDL_GL_DOUBLEBUFFER:
5.198 + wgl_attrib = WGL_DOUBLE_BUFFER_ARB;
5.199 + break;
5.200 + case SDL_GL_BUFFER_SIZE:
5.201 + wgl_attrib = WGL_COLOR_BITS_ARB;
5.202 + break;
5.203 + case SDL_GL_DEPTH_SIZE:
5.204 + wgl_attrib = WGL_DEPTH_BITS_ARB;
5.205 + break;
5.206 + case SDL_GL_STENCIL_SIZE:
5.207 + wgl_attrib = WGL_STENCIL_BITS_ARB;
5.208 + break;
5.209 + case SDL_GL_ACCUM_RED_SIZE:
5.210 + wgl_attrib = WGL_ACCUM_RED_BITS_ARB;
5.211 + break;
5.212 + case SDL_GL_ACCUM_GREEN_SIZE:
5.213 + wgl_attrib = WGL_ACCUM_GREEN_BITS_ARB;
5.214 + break;
5.215 + case SDL_GL_ACCUM_BLUE_SIZE:
5.216 + wgl_attrib = WGL_ACCUM_BLUE_BITS_ARB;
5.217 + break;
5.218 + case SDL_GL_ACCUM_ALPHA_SIZE:
5.219 + wgl_attrib = WGL_ACCUM_ALPHA_BITS_ARB;
5.220 + break;
5.221 + case SDL_GL_STEREO:
5.222 + wgl_attrib = WGL_STEREO_ARB;
5.223 + break;
5.224 + case SDL_GL_SAMPLE_BUFFERS:
5.225 + wgl_attrib = WGL_SAMPLE_BUFFERS_ARB;
5.226 + break;
5.227 + case SDL_GL_SAMPLES:
5.228 + wgl_attrib = WGL_SAMPLES_ARB;
5.229 + break;
5.230 + default:
5.231 + return(-1);
5.232 + }
5.233 + this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, pixel_format, 0, 1, &wgl_attrib, value);
5.234 +
5.235 + return 0;
5.236 + }
5.237
5.238 retval = 0;
5.239 - switch( attrib ) {
5.240 + switch ( attrib ) {
5.241 case SDL_GL_RED_SIZE:
5.242 *value = GL_pfd.cRedBits;
5.243 break;
5.244 @@ -275,6 +459,8 @@
5.245 this->gl_data->wglCreateContext = NULL;
5.246 this->gl_data->wglDeleteContext = NULL;
5.247 this->gl_data->wglMakeCurrent = NULL;
5.248 + this->gl_data->wglChoosePixelFormatARB = NULL;
5.249 + this->gl_data->wglGetPixelFormatAttribivARB = NULL;
5.250
5.251 this->gl_config.dll_handle = NULL;
5.252 this->gl_config.driver_loaded = 0;
5.253 @@ -304,6 +490,7 @@
5.254 WIN_GL_UnloadLibrary(this);
5.255
5.256 /* Load new function pointers */
5.257 + memset(this->gl_data, 0, sizeof(*this->gl_data));
5.258 this->gl_data->wglGetProcAddress = (void * (WINAPI *)(const char *))
5.259 GetProcAddress(handle, "wglGetProcAddress");
5.260 this->gl_data->wglCreateContext = (HGLRC (WINAPI *)(HDC))
6.1 --- a/src/video/wincommon/SDL_wingl_c.h Tue Jul 22 14:01:21 2003 +0000
6.2 +++ b/src/video/wincommon/SDL_wingl_c.h Tue Jul 22 15:10:06 2003 +0000
6.3 @@ -37,6 +37,8 @@
6.4 PIXELFORMATDESCRIPTOR GL_pfd;
6.5 HDC GL_hdc;
6.6 HGLRC GL_hrc;
6.7 + int pixel_format;
6.8 + int wgl_arb_pixel_format;
6.9
6.10 void * (WINAPI *wglGetProcAddress)(const char *proc);
6.11
6.12 @@ -45,7 +47,16 @@
6.13 BOOL (WINAPI *wglDeleteContext)(HGLRC hglrc);
6.14
6.15 BOOL (WINAPI *wglMakeCurrent)(HDC hdc, HGLRC hglrc);
6.16 -
6.17 +
6.18 + BOOL (WINAPI *wglChoosePixelFormatARB)(HDC hdc, const int *piAttribIList,
6.19 + const FLOAT *pfAttribFList,
6.20 + UINT nMaxFormats, int *piFormats,
6.21 + UINT *nNumFormats);
6.22 + BOOL (WINAPI *wglGetPixelFormatAttribivARB)(HDC hdc, int iPixelFormat,
6.23 + int iLayerPlane,
6.24 + UINT nAttributes,
6.25 + const int *piAttributes,
6.26 + int *piValues);
6.27 #endif /* HAVE_OPENGL */
6.28 };
6.29
6.30 @@ -54,6 +65,7 @@
6.31 #define GL_pfd (this->gl_data->GL_pfd)
6.32 #define GL_hdc (this->gl_data->GL_hdc)
6.33 #define GL_hrc (this->gl_data->GL_hrc)
6.34 +#define pixel_format (this->gl_data->pixel_format)
6.35
6.36 /* OpenGL functions */
6.37 extern int WIN_GL_SetupWindow(_THIS);
6.38 @@ -67,3 +79,63 @@
6.39 extern void *WIN_GL_GetProcAddress(_THIS, const char* proc);
6.40 #endif
6.41
6.42 +#ifdef HAVE_OPENGL
6.43 +
6.44 +#ifndef WGL_ARB_pixel_format
6.45 +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
6.46 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001
6.47 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002
6.48 +#define WGL_ACCELERATION_ARB 0x2003
6.49 +#define WGL_NEED_PALETTE_ARB 0x2004
6.50 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
6.51 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
6.52 +#define WGL_SWAP_METHOD_ARB 0x2007
6.53 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008
6.54 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
6.55 +#define WGL_TRANSPARENT_ARB 0x200A
6.56 +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
6.57 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
6.58 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
6.59 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
6.60 +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
6.61 +#define WGL_SHARE_DEPTH_ARB 0x200C
6.62 +#define WGL_SHARE_STENCIL_ARB 0x200D
6.63 +#define WGL_SHARE_ACCUM_ARB 0x200E
6.64 +#define WGL_SUPPORT_GDI_ARB 0x200F
6.65 +#define WGL_SUPPORT_OPENGL_ARB 0x2010
6.66 +#define WGL_DOUBLE_BUFFER_ARB 0x2011
6.67 +#define WGL_STEREO_ARB 0x2012
6.68 +#define WGL_PIXEL_TYPE_ARB 0x2013
6.69 +#define WGL_COLOR_BITS_ARB 0x2014
6.70 +#define WGL_RED_BITS_ARB 0x2015
6.71 +#define WGL_RED_SHIFT_ARB 0x2016
6.72 +#define WGL_GREEN_BITS_ARB 0x2017
6.73 +#define WGL_GREEN_SHIFT_ARB 0x2018
6.74 +#define WGL_BLUE_BITS_ARB 0x2019
6.75 +#define WGL_BLUE_SHIFT_ARB 0x201A
6.76 +#define WGL_ALPHA_BITS_ARB 0x201B
6.77 +#define WGL_ALPHA_SHIFT_ARB 0x201C
6.78 +#define WGL_ACCUM_BITS_ARB 0x201D
6.79 +#define WGL_ACCUM_RED_BITS_ARB 0x201E
6.80 +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
6.81 +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
6.82 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
6.83 +#define WGL_DEPTH_BITS_ARB 0x2022
6.84 +#define WGL_STENCIL_BITS_ARB 0x2023
6.85 +#define WGL_AUX_BUFFERS_ARB 0x2024
6.86 +#define WGL_NO_ACCELERATION_ARB 0x2025
6.87 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026
6.88 +#define WGL_FULL_ACCELERATION_ARB 0x2027
6.89 +#define WGL_SWAP_EXCHANGE_ARB 0x2028
6.90 +#define WGL_SWAP_COPY_ARB 0x2029
6.91 +#define WGL_SWAP_UNDEFINED_ARB 0x202A
6.92 +#define WGL_TYPE_RGBA_ARB 0x202B
6.93 +#define WGL_TYPE_COLORINDEX_ARB 0x202C
6.94 +#endif
6.95 +
6.96 +#ifndef WGL_ARB_multisample
6.97 +#define WGL_SAMPLE_BUFFERS_ARB 0x2041
6.98 +#define WGL_SAMPLES_ARB 0x2042
6.99 +#endif
6.100 +
6.101 +#endif
7.1 --- a/src/video/x11/SDL_x11gl.c Tue Jul 22 14:01:21 2003 +0000
7.2 +++ b/src/video/x11/SDL_x11gl.c Tue Jul 22 15:10:06 2003 +0000
7.3 @@ -122,6 +122,16 @@
7.4 attribs[i++] = GLX_STEREO;
7.5 attribs[i++] = this->gl_config.stereo;
7.6 }
7.7 +
7.8 + if( this->gl_config.sample_buffers ) {
7.9 + attribs[i++] = GLX_SAMPLE_BUFFERS_ARB;
7.10 + attribs[i++] = this->gl_config.sample_buffers;
7.11 + }
7.12 +
7.13 + if( this->gl_config.samples ) {
7.14 + attribs[i++] = GLX_SAMPLES_ARB;
7.15 + attribs[i++] = this->gl_config.samples;
7.16 + }
7.17
7.18 #ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */
7.19 attribs[i++] = GLX_X_VISUAL_TYPE;
7.20 @@ -229,7 +239,7 @@
7.21
7.22 #ifdef HAVE_OPENGL
7.23
7.24 -static int ExtensionSupported(const char *extension, const char *all_extensions)
7.25 +static int ExtensionSupported(const char *extension)
7.26 {
7.27 const GLubyte *extensions = NULL;
7.28 const GLubyte *start;
7.29 @@ -266,7 +276,6 @@
7.30 int X11_GL_MakeCurrent(_THIS)
7.31 {
7.32 int retval;
7.33 - const char *glx_extensions;
7.34
7.35 retval = 0;
7.36 if ( ! this->gl_data->glXMakeCurrent(GFX_Display,
7.37 @@ -276,7 +285,6 @@
7.38 }
7.39 XSync( GFX_Display, False );
7.40
7.41 -
7.42 /*
7.43 * The context is now current, check for glXReleaseBuffersMESA()
7.44 * extension. If extension is _not_ supported, destroy the pointer
7.45 @@ -296,10 +304,10 @@
7.46 *
7.47 */
7.48
7.49 - glx_extensions = this->gl_data->glXQueryExtensionsString(GFX_Display, SDL_Screen);
7.50 - if (!ExtensionSupported("glXReleaseBuffersMESA", glx_extensions)) this->gl_data->glXReleaseBuffersMESA = NULL;
7.51 -
7.52 -
7.53 + if ( ! ExtensionSupported("glXReleaseBuffersMESA") ) {
7.54 + this->gl_data->glXReleaseBuffersMESA = NULL;
7.55 + }
7.56 +
7.57 /* More Voodoo X server workarounds... Grr... */
7.58 SDL_Lock_EventThread();
7.59 X11_CheckDGAMouse(this);
7.60 @@ -354,6 +362,12 @@
7.61 case SDL_GL_STEREO:
7.62 glx_attrib = GLX_STEREO;
7.63 break;
7.64 + case SDL_GL_SAMPLE_BUFFERS:
7.65 + glx_attrib = GLX_SAMPLE_BUFFERS_ARB;
7.66 + break;
7.67 + case SDL_GL_SAMPLES:
7.68 + glx_attrib = GLX_SAMPLES_ARB;
7.69 + break;
7.70 default:
7.71 return(-1);
7.72 }
8.1 --- a/test/testgl.c Tue Jul 22 14:01:21 2003 +0000
8.2 +++ b/test/testgl.c Tue Jul 22 15:10:06 2003 +0000
8.3 @@ -393,7 +393,7 @@
8.4 }
8.5
8.6 int RunGLTest( int argc, char* argv[],
8.7 - int logo, int slowly, int bpp, float gamma, int noframe )
8.8 + int logo, int slowly, int bpp, float gamma, int noframe, int fsaa )
8.9 {
8.10 int i;
8.11 int rgb_size[3];
8.12 @@ -475,6 +475,10 @@
8.13 SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, rgb_size[2] );
8.14 SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
8.15 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
8.16 + if ( fsaa ) {
8.17 + SDL_GL_SetAttribute( SDL_GL_SAMPLE_BUFFERS, 1 );
8.18 + SDL_GL_SetAttribute( SDL_GL_SAMPLES, fsaa );
8.19 + }
8.20 if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) {
8.21 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
8.22 SDL_Quit();
8.23 @@ -499,6 +503,12 @@
8.24 printf( "SDL_GL_DEPTH_SIZE: requested %d, got %d\n", bpp, value );
8.25 SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &value );
8.26 printf( "SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value );
8.27 + if ( fsaa ) {
8.28 + SDL_GL_GetAttribute( SDL_GL_SAMPLE_BUFFERS, &value );
8.29 + printf( "SDL_GL_SAMPLE_BUFFERS: requested 1, got %d\n", value );
8.30 + SDL_GL_GetAttribute( SDL_GL_SAMPLES, &value );
8.31 + printf( "SDL_GL_SAMPLES: requested %d, got %d\n", fsaa, value );
8.32 + }
8.33
8.34 /* Set the window manager title bar */
8.35 SDL_WM_SetCaption( "SDL GL test", "testgl" );
8.36 @@ -700,6 +710,7 @@
8.37 int slowly;
8.38 float gamma = 0.0;
8.39 int noframe = 0;
8.40 + int fsaa = 0;
8.41
8.42 logo = 0;
8.43 slowly = 0;
8.44 @@ -728,15 +739,18 @@
8.45 if ( strcmp(argv[i], "-noframe") == 0 ) {
8.46 noframe = 1;
8.47 }
8.48 + if ( strcmp(argv[i], "-fsaa") == 0 ) {
8.49 + ++fsaa;
8.50 + }
8.51 if ( strncmp(argv[i], "-h", 2) == 0 ) {
8.52 printf(
8.53 -"Usage: %s [-twice] [-logo] [-slow] [-bpp n] [-gamma n] [-noframe]\n",
8.54 +"Usage: %s [-twice] [-logo] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa]\n",
8.55 argv[0]);
8.56 exit(0);
8.57 }
8.58 }
8.59 for ( i=0; i<numtests; ++i ) {
8.60 - RunGLTest(argc, argv, logo, slowly, bpp, gamma, noframe);
8.61 + RunGLTest(argc, argv, logo, slowly, bpp, gamma, noframe, fsaa);
8.62 }
8.63 return 0;
8.64 }