Commit 52e1d769 authored by Sam Lantinga's avatar Sam Lantinga

Merged in Ryan's multisample code for MacOS, and changed the constants to match.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40657
parent 800e2d5e
...@@ -6,7 +6,7 @@ Version 1.0: ...@@ -6,7 +6,7 @@ Version 1.0:
1.2.6: 1.2.6:
Added SDL_LoadObject(), SDL_LoadFunction(), and SDL_UnloadObject() 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: 1.2.5:
Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5) Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5)
......
...@@ -218,8 +218,8 @@ typedef enum { ...@@ -218,8 +218,8 @@ typedef enum {
SDL_GL_ACCUM_BLUE_SIZE, SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE, SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO, SDL_GL_STEREO,
SDL_GL_SAMPLE_BUFFERS, SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_SAMPLES SDL_GL_MULTISAMPLESAMPLES
} SDL_GLattr; } SDL_GLattr;
/* flags for SDL_SetPalette() */ /* flags for SDL_SetPalette() */
......
...@@ -304,8 +304,8 @@ struct SDL_VideoDevice { ...@@ -304,8 +304,8 @@ struct SDL_VideoDevice {
int accum_blue_size; int accum_blue_size;
int accum_alpha_size; int accum_alpha_size;
int stereo; int stereo;
int sample_buffers; int multisamplebuffers;
int samples; int multisamplesamples;
int driver_loaded; int driver_loaded;
char driver_path[256]; char driver_path[256];
void* dll_handle; void* dll_handle;
......
...@@ -233,8 +233,8 @@ int SDL_VideoInit (const char *driver_name, Uint32 flags) ...@@ -233,8 +233,8 @@ int SDL_VideoInit (const char *driver_name, Uint32 flags)
video->gl_config.accum_blue_size = 0; video->gl_config.accum_blue_size = 0;
video->gl_config.accum_alpha_size = 0; video->gl_config.accum_alpha_size = 0;
video->gl_config.stereo = 0; video->gl_config.stereo = 0;
video->gl_config.sample_buffers = 0; video->gl_config.multisamplebuffers = 0;
video->gl_config.samples = 0; video->gl_config.multisamplesamples = 0;
/* Initialize the video subsystem */ /* Initialize the video subsystem */
memset(&vformat, 0, sizeof(vformat)); memset(&vformat, 0, sizeof(vformat));
...@@ -1422,11 +1422,11 @@ int SDL_GL_SetAttribute( SDL_GLattr attr, int value ) ...@@ -1422,11 +1422,11 @@ int SDL_GL_SetAttribute( SDL_GLattr attr, int value )
case SDL_GL_STEREO: case SDL_GL_STEREO:
video->gl_config.stereo = value; video->gl_config.stereo = value;
break; break;
case SDL_GL_SAMPLE_BUFFERS: case SDL_GL_MULTISAMPLEBUFFERS:
video->gl_config.sample_buffers = value; video->gl_config.multisamplebuffers = value;
break; break;
case SDL_GL_SAMPLES: case SDL_GL_MULTISAMPLESAMPLES:
video->gl_config.samples = value; video->gl_config.multisamplesamples = value;
break; break;
default: default:
SDL_SetError("Unknown OpenGL attribute"); SDL_SetError("Unknown OpenGL attribute");
......
...@@ -49,6 +49,14 @@ int Mac_GL_Init(_THIS) ...@@ -49,6 +49,14 @@ int Mac_GL_Init(_THIS)
if ( this->gl_config.stereo ) { if ( this->gl_config.stereo ) {
attributes[i++] = AGL_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 ) { if ( this->gl_config.depth_size != 0 ) {
attributes[i++] = AGL_DEPTH_SIZE; attributes[i++] = AGL_DEPTH_SIZE;
attributes[i++] = this->gl_config.depth_size; attributes[i++] = this->gl_config.depth_size;
......
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
#include <OpenGL/OpenGL.h> #include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include <QuickTime/QuickTime.h> #include <QuickTime/QuickTime.h>
#include <IOKit/IOKitLib.h> /* For powersave handling */ #include <IOKit/IOKitLib.h> /* For powersave handling */
......
...@@ -1419,6 +1419,16 @@ static int QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags) { ...@@ -1419,6 +1419,16 @@ static int QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags) {
attr[i++] = this->gl_config.stencil_size; 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++] = NSOpenGLPFAScreenMask;
attr[i++] = CGDisplayIDToOpenGLDisplayMask (display_id); attr[i++] = CGDisplayIDToOpenGLDisplayMask (display_id);
attr[i] = 0; attr[i] = 0;
...@@ -1503,6 +1513,8 @@ static int QZ_GL_GetAttribute (_THIS, SDL_GLattr attrib, int* value) { ...@@ -1503,6 +1513,8 @@ static int QZ_GL_GetAttribute (_THIS, SDL_GLattr attrib, int* value) {
case SDL_GL_ACCUM_BLUE_SIZE: attr = GL_ACCUM_BLUE_BITS; break; 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_ACCUM_ALPHA_SIZE: attr = GL_ACCUM_ALPHA_BITS; break;
case SDL_GL_STEREO: attr = GL_STEREO; 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: case SDL_GL_BUFFER_SIZE:
{ {
GLint bits = 0; GLint bits = 0;
......
...@@ -237,14 +237,14 @@ int WIN_GL_SetupWindow(_THIS) ...@@ -237,14 +237,14 @@ int WIN_GL_SetupWindow(_THIS)
*iAttr++ = this->gl_config.stereo; *iAttr++ = this->gl_config.stereo;
} }
if ( this->gl_config.sample_buffers ) { if ( this->gl_config.multisamplebuffers ) {
*iAttr++ = WGL_SAMPLE_BUFFERS_ARB; *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++ = WGL_SAMPLES_ARB;
*iAttr++ = this->gl_config.samples; *iAttr++ = this->gl_config.multisamplesamples;
} }
*iAttr = 0; *iAttr = 0;
...@@ -375,10 +375,10 @@ int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) ...@@ -375,10 +375,10 @@ int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
case SDL_GL_STEREO: case SDL_GL_STEREO:
wgl_attrib = WGL_STEREO_ARB; wgl_attrib = WGL_STEREO_ARB;
break; break;
case SDL_GL_SAMPLE_BUFFERS: case SDL_GL_MULTISAMPLEBUFFERS:
wgl_attrib = WGL_SAMPLE_BUFFERS_ARB; wgl_attrib = WGL_SAMPLE_BUFFERS_ARB;
break; break;
case SDL_GL_SAMPLES: case SDL_GL_MULTISAMPLESAMPLES:
wgl_attrib = WGL_SAMPLES_ARB; wgl_attrib = WGL_SAMPLES_ARB;
break; break;
default: default:
......
...@@ -123,14 +123,14 @@ XVisualInfo *X11_GL_GetVisual(_THIS) ...@@ -123,14 +123,14 @@ XVisualInfo *X11_GL_GetVisual(_THIS)
attribs[i++] = this->gl_config.stereo; 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++] = 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++] = 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 */ #ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */
...@@ -362,10 +362,10 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) ...@@ -362,10 +362,10 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
case SDL_GL_STEREO: case SDL_GL_STEREO:
glx_attrib = GLX_STEREO; glx_attrib = GLX_STEREO;
break; break;
case SDL_GL_SAMPLE_BUFFERS: case SDL_GL_MULTISAMPLEBUFFERS:
glx_attrib = GLX_SAMPLE_BUFFERS_ARB; glx_attrib = GLX_SAMPLE_BUFFERS_ARB;
break; break;
case SDL_GL_SAMPLES: case SDL_GL_MULTISAMPLESAMPLES:
glx_attrib = GLX_SAMPLES_ARB; glx_attrib = GLX_SAMPLES_ARB;
break; break;
default: default:
......
...@@ -476,8 +476,8 @@ int RunGLTest( int argc, char* argv[], ...@@ -476,8 +476,8 @@ int RunGLTest( int argc, char* argv[],
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
if ( fsaa ) { if ( fsaa ) {
SDL_GL_SetAttribute( SDL_GL_SAMPLE_BUFFERS, 1 ); SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
SDL_GL_SetAttribute( SDL_GL_SAMPLES, fsaa ); SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa );
} }
if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) { if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) {
fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
...@@ -504,10 +504,10 @@ int RunGLTest( int argc, char* argv[], ...@@ -504,10 +504,10 @@ int RunGLTest( int argc, char* argv[],
SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &value ); SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &value );
printf( "SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value ); printf( "SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value );
if ( fsaa ) { if ( fsaa ) {
SDL_GL_GetAttribute( SDL_GL_SAMPLE_BUFFERS, &value ); SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &value );
printf( "SDL_GL_SAMPLE_BUFFERS: requested 1, got %d\n", value ); printf( "SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value );
SDL_GL_GetAttribute( SDL_GL_SAMPLES, &value ); SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &value );
printf( "SDL_GL_SAMPLES: requested %d, got %d\n", fsaa, value ); printf( "SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value );
} }
/* Set the window manager title bar */ /* Set the window manager title bar */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment