Post the code snippet where you’re using it, we’ll take a look. Only
thing I can think of off the top of my head is that you are setting
the GL attribute after calling SDL_SetVideoMode…everything after
that is a non-obvious bug…
Here is my unmodified main() function below. Note I enable FSAA by
calling “glEnable(GL_MULTISAMPLE_ARB);” as the first function in init()
seen below.
Thanks so much,
.derek.arndt
//-----------main-----------//
int main( int argc, char *argv )
{
int videoFlags;
int done = FALSE;
/ this holds some info about our display */
const SDL_VideoInfo *videoInfo;
SDL_Joystick *joystick;
/* initialize SDL */
if(USE_JOYSTICK)
SDL_Init( SDL_INIT_VIDEO | SDL_INIT_JOYSTICK );
else
SDL_Init( SDL_INIT_VIDEO );
/* Fetch the video info */
videoInfo = SDL_GetVideoInfo( );
if(!videoInfo) {
fprintf( stderr, "Video query failed: %s\n", SDL_GetError( ) );
quit(1);
}
/* the flags to pass to SDL_SetVideoMode */
videoFlags = SDL_OPENGL; /* Enable OpenGL in SDL */
videoFlags |= SDL_HWPALETTE; /* Store the palette in hardware
*/
if(FULLSCREEN)
videoFlags |= SDL_FULLSCREEN;
/* This checks to see if surfaces can be stored in memory */
if ( videoInfo->hw_available )
videoFlags |= SDL_HWSURFACE;
else
videoFlags |= SDL_SWSURFACE;
/* This checks if hardware blits can be done */
if ( videoInfo->blit_hw )
videoFlags |= SDL_HWACCEL;
// Initialize Joystick if necessary
if(USE_JOYSTICK) {
printf("%i joysticks were found.\n\n", SDL_NumJoysticks() );
printf("The names of the joysticks are:\n");
for( int i=0; i < SDL_NumJoysticks(); i++ )
printf(" %s\n", SDL_JoystickName(i));
printf("Using Joystick 0\n\n");
SDL_JoystickEventState(SDL_ENABLE);
joystick = SDL_JoystickOpen(0);
}
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, SCREEN_BPP ); //
size of depth buffer
SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0 ); // we aren’t
going to use the stencil buffer
SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0 ); // this and
the next three lines set the bits allocated per pixel -
SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0 ); // - for the
accumulation buffer to 0
SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0 );
SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0 );
if(FSAA) { // bring on the anti-aliasing!
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, FSAA );
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, FSAA_SAMPLES );
printf("Using FSAA with %dx sampling\n\n", FSAA_SAMPLES);
}
/* get a SDL surface */
surface = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT,
SCREEN_BPP, videoFlags );
/* Verify there is a surface */
if(!surface){
fprintf( stderr, "Video mode set failed: %s\n", SDL_GetError()
);
quit(1);
}
// Call all the intialization stuff...yes I said stuff...
init();
/* wait for events */
while ( !done )
{
/* handle the events in the queue */
while ( SDL_PollEvent( &event ) )
{
switch( event.type )
{
case SDL_KEYDOWN:
handleKeyPress( &event.key.keysym );
break;
case SDL_KEYUP:
handleKeyRelease( &event.key.keysym ); //
callback for handling keystrokes, arg is key released
break;
case SDL_JOYAXISMOTION: /* Handle Joystick
Motion /
handleJoystickMotion( &event.jaxis.axis,
&event.jaxis.value );
break;
case SDL_JOYBUTTONDOWN: / Handle Joystick
Button Presses */
if ( event.jbutton.button == 8 )
{
if(playerShip.smoking)
playerShip.smoking = 0;
else
playerShip.smoking = 1;
}
break;
case SDL_QUIT:
done = TRUE;
break;
default:
break;
}
}
g_Camera.Update();
keyDown();
drawGLScene();
}
/* clean ourselves up and exit */
alutExit();
music_track.release();
quit(0);
/* Should never get here */
return(0);
}On Dec 3, 2003, at 8:04 AM, Ryan C. Gordon wrote:
I’m wondering if I have to load in GL_ARB_multisample to use
multisampling in my app. I assumed I’d only have to set the
attributes for SDL and enable it from what I’ve been reading, but I
could easily be wrong. If I do need to load in the extension what
would probably be the best way to load it in OS X? (is there a good
lib out there, or simple code or something)
No, it works in UT2003 through SDL without any OSX-specific code.
UT2003 is using a hacked up SDL…the code in CVS is based on that
version of SDL, but it’s possible something changed or broke along the
way.
Post the code snippet where you’re using it, we’ll take a look. Only
thing I can think of off the top of my head is that you are setting
the GL attribute after calling SDL_SetVideoMode…everything after
that is a non-obvious bug…
–ryan.
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: text/enriched
Size: 9578 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20031203/3832cc21/attachment.bin