Thanks the replies people.
I’m running Win 2000, have got the very latest drivers (there were a new set
released a week or so ago).
How do I test if the surface is in fact in hardware? Even so from what you
say it should be quick enough in software. My AGP is 4x. In a window it’s
about 8 fps better than fullscreen.
I’ll put some of the bits of code here. Grrr. my tabs all go haywire.
mainGlobs is just a structure to hold any global variables for main.c. It’s
declared at the top of main.c and no other source file has access to it
unless by Get and Set function calls.
Thanks for any help.
typedef struct
{
SDL_Surface *screen;
BOOL useHardware;
BOOL windowed;
U32 width;
U32 height;
U32 depth;
}mainGlobsType, *lpMainGlobsType;
mainGlobsType mainGlobs = { 0 };
Setting the video mode…
void Main_SetVideoMode( U32 width, U32 height, U32 depth, BOOL isFullScreen,
BOOL useHardware)
{
U32 flags = 0;
mainGlobs.useHardware = useHardware;
mainGlobs.isWindowed = !isFullScreen;
mainGlobs.width = width;
mainGlobs.height = height;
mainGlobs.depth = depth;
if (useHardware) flags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
else flags |= SDL_SWSURFACE ;
if (fullScreen) flags |= SDL_FULLSCREEN;
mainGlobs.screen = SDL_SetVideoMode(width, height, depth, flags );
}
creating an image…
lpImage Image_Create(lpFILENAME imageFilename )
{
lpImage newImage = NULL;
if (imageFilename)
{
newImage = (lpImage) Mem_Alloc( sizeof( struct _Image ) );
if (newImage)
{
newImage->sdlSurface = IMG_Load( imageFilename );
SDL_DisplayFormat(newImage->sdlSurface) ;
if (newImage->sdlSurface)
{
Image_SetFlags( newImage, 0 );
}
else
{
Mem_Free(newImage);
newImage = NULL;
}
}
}
return newImage;
}
rendering an image…
VOID Image_RenderSurface( lpImage image, S16 x, S16 y )
{
SDL_Rect destSDL;
if (image)
{
destSDL.x = x;
destSDL.y = y;
destSDL.w = 0;
destSDL.h = 0;
SDL_BlitSurface( image->sdlSurface, NULL, Main_GetScreen(), &destSDL);
}
}> ----- Original Message -----
From: bob@pendleton.com (Bob Pendleton)
To: “SDL Mailing List”
Sent: Thursday, June 05, 2003 5:12 PM
Subject: Re: [SDL] still haven’t found my framerate.
On Wed, 2003-06-04 at 22:28, David Hedbor wrote:
“Scott Newby” writes:
Hello
I’ve tried tonnes of things now to get my framerate back up and still
haven’t succeeded. My system spec is a P4 2 GHz, 256 DDR Ram and a
Geforce
4 - Ti4600.
I’ve tried creating the surfaces in hardware and software, with double
buffering, without double buffering and so on.
Did you actually test to see that you got hardware surfaces? Just
telling SDL to create the surface in hardware does not ensure that it is
created in hardware.
How did you set the bits/pixel? Is it the same as the screen setting on
the machine. Full screen or a window? Do you base the setting on
information you get back from SDL or do you just set it?
What is the AGP bus speed on your computer? What is the AGP aperture
size set to?
What OS are you using and have you upgraded to the latest drivers?
I’m asking all this because on a machine with about a quarter the speed
of yours doing about half the work you are doing entirely in software I
have to throttle my code to stay under 100 FPS.
You can see that code at:
http://linux.oreillynet.com/pub/a/linux/2003/05/15/sdl_anim.html?page=last&x
-showcontent=text#thread
If I draw 1 large 640x480 image at 32 bit. Then fill the screen with
32x32
images over the top (so it’s a tiled map ) I’m pretty much drawing the
screen twice with the extra overhead of lots of smaller blits for the
second
layer.
My frames per second is like 17-20fps for this.
Is this roughly correct? When I switch to CDX I get 800+ but I’d
prefer to
use SDL.
Any suggestions?
Can you post the program / graphics your using for testing perhaps?
That might help us help you.
–
±----------------------------------+
- Bob Pendleton: independent writer +
- and programmer. +
- email: Bob at Pendleton.com +
±----------------------------------+
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl