Hi!
> First, is the modifications in the configure script works well for you ?
Everything is alright there! :)
> About the framerate,
> By now, everything is rendered in software in the SDL port.
> It gives me (Athlon 2600)
> - between 32 and 44 fps in 800x600
> - between 21- 31 fps in 1024x768
>
> Let me know what you obtain.
Using the map 'Cowland', on a pentium 4 M, at 2.0GHz, with a GeForce 4:
- 20~30 fps in 640x480
- 10~15 fps in 800x600
Which is quite slow compared to your performance :(
I don't know many things about SDL flags..
If it helps, there is a function in one of paragui examples, which
initializes sdl with the best gfx flags. It's in the test/dblbuffer.cpp,
or the main part of this code in attachement to this mail.
Lodesi
/* This is a way of telling whether or not to use hardware surfaces */
Uint32 FastestFlags(Uint32 flags, int width, int height, int bpp)
{
const SDL_VideoInfo *info;
/* Hardware acceleration is only used in fullscreen mode */
flags |= SDL_FULLSCREEN;
/* Check for various video capabilities */
info = SDL_GetVideoInfo();
if ( info->blit_hw_CC && info->blit_fill ) {
/* We use accelerated colorkeying and color filling */
flags |= SDL_HWSURFACE;
}
/* If we have enough video memory, and will use accelerated
blits directly to it, then use page flipping.
*/
if ( (flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
/* Direct hardware blitting without double-buffering
causes really bad flickering.
*/
if ( info->video_mem*1024 > (Uint32)(height*width*bpp/8) ) {
flags |= SDL_DOUBLEBUF;
} else {
flags &= ~SDL_HWSURFACE;
}
}
/* Return the flags */
return(flags);
}
int main(int argc, char *argv[])
{
SDL_Surface *screen;
Uint8 *mem;
int width, height;
Uint8 video_bpp;
Uint32 videoflags;
Uint32 background;
int i;
SDL_Event event;
Uint32 then, now, frames;
PG_Application app;
numsprites = NUM_SPRITES;
videoflags = SDL_SWSURFACE|SDL_DOUBLEBUF | SDL_ANYFORMAT;
width = 640;
height = 480;
video_bpp = 16;
while ( argc > 1 ) {
--argc;
if ( strcmp(argv[argc-1], "-width") == 0 ) {
width = atoi(argv[argc]);
--argc;
} else
if ( strcmp(argv[argc-1], "-height") == 0 ) {
height = atoi(argv[argc]);
--argc;
} else
if ( strcmp(argv[argc-1], "-bpp") == 0 ) {
video_bpp = atoi(argv[argc]);
videoflags &= ~SDL_ANYFORMAT;
--argc;
} else
if ( strcmp(argv[argc], "-fast") == 0 ) {
videoflags = FastestFlags(videoflags, width, height, video_bpp);
} else
if ( strcmp(argv[argc], "-hw") == 0 ) {
videoflags ^= SDL_HWSURFACE;
} else
if ( strcmp(argv[argc], "-flip") == 0 ) {
videoflags ^= SDL_DOUBLEBUF;
} else
if ( strcmp(argv[argc], "-fullscreen") == 0 ) {
videoflags ^= SDL_FULLSCREEN;
} else
if ( isdigit(argv[argc][0]) ) {
numsprites = atoi(argv[argc]);
} else {
PG_LogMSG(
"Usage: %s [-bpp N] [-hw] [-flip] [-fast] [-fullscreen] [numsprites]",
argv[0]);
exit(1);
}
}
/* Set video mode */
if(!app.InitScreen(width, height, video_bpp, videoflags)) {
PG_LogERR("Couldn't set %dx%d video mode: %s",
width, height, SDL_GetError());
exit(2);
}
/* Print out information about our surfaces */
PG_LogMSG("Screen is at %d bits per pixel",screen->format->BitsPerPixel);
if ( (screen->flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
PG_LogMSG("Screen is in video memory");
} else {
PG_LogMSG("Screen is in system memory");
}
if ( (screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) {
PG_LogMSG("Screen has double-buffering enabled");
}
if ( (sprite->flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
PG_LogMSG("Sprite is in video memory");
} else {
PG_LogMSG("Sprite is in system memory");
}
/* Run a sample blit to trigger blit acceleration */
{ SDL_Rect dst;
dst.x = 0;
dst.y = 0;
dst.w = sprite->w;
dst.h = sprite->h;
SDL_BlitSurface(sprite, NULL, screen, &dst);
SDL_FillRect(screen, &dst, background);
}
if ( (sprite->flags & SDL_HWACCEL) == SDL_HWACCEL ) {
PG_LogMSG("Sprite blit uses hardware acceleration");
}
if ( (sprite->flags & SDL_RLEACCEL) == SDL_RLEACCEL ) {
PG_LogMSG("Sprite blit uses RLE acceleration");
}
return(0);
}