Skip to content
Permalink
Browse files

Merged in Ryan's multisample code for MacOS, and changed the constant…

…s to match.
  • Loading branch information
slouken committed Jul 22, 2003
1 parent 18bd3a0 commit 9316bc9d427c6174b0018b34ecec8a8b08dcc327
@@ -6,7 +6,7 @@ Version 1.0:
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)
@@ -218,8 +218,8 @@ typedef enum {
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() */
@@ -304,8 +304,8 @@ struct SDL_VideoDevice {
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;
@@ -233,8 +233,8 @@ int SDL_VideoInit (const char *driver_name, Uint32 flags)
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 @@ int SDL_GL_SetAttribute( SDL_GLattr attr, int value )
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");
@@ -49,6 +49,14 @@ int Mac_GL_Init(_THIS)
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;
@@ -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 */
@@ -1419,6 +1419,16 @@ static int QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags) {
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 @@ 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_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;
@@ -237,14 +237,14 @@ int WIN_GL_SetupWindow(_THIS)
*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 @@ int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
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:
@@ -123,14 +123,14 @@ XVisualInfo *X11_GL_GetVisual(_THIS)
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 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
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:
@@ -476,8 +476,8 @@ int RunGLTest( int argc, char* argv[],
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 @@ int RunGLTest( int argc, char* argv[],
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 */

0 comments on commit 9316bc9

Please sign in to comment.