Fast array->Screen routine

Hi!

new to this list, so this subject may have been discussed before…

currently writing a game in a 320x240x24 resolution, so i started out by
creating an unsigned char Array wish I wanted to contain my pixels ( doing a
lot of pixel based operations )

but my problem is that I only get 20 fps on a K6-2 350 and 60fps on a Cel
466 BOTH running with a TNT2 under windows … have i made a serious error
somewhere in my “Copy-from-array-to-screen”-routine or ?

anyways… it goes like this:
// ----
if ( SDL_LockSurface(video) == 0 )
{
int row;
Uint8 *src, *dst;

		src = myscreen;
		dst = (Uint8 *)video->pixels;

            memcpy(dst,src,230400); // ( 320*240*3 = 230400)

		SDL_UnlockSurface(video);
	}
	SDL_UpdateRect(video, 0, 0, 0, 0);

// ----

…Kenneth “fessor” Christensen

Hi!

new to this list, so this subject may have been discussed before…

currently writing a game in a 320x240x24 resolution, so i started out by
creating an unsigned char Array wish I wanted to contain my pixels ( doing a
lot of pixel based operations )

but my problem is that I only get 20 fps on a K6-2 350 and 60fps on a Cel
466 BOTH running with a TNT2 under windows … have i made a serious error
somewhere in my “Copy-from-array-to-screen”-routine or ?

anyways… it goes like this:
// ----
if ( SDL_LockSurface(video) == 0 )
{
int row;
Uint8 *src, *dst;

		src = myscreen;
		dst = (Uint8 *)video->pixels;

            memcpy(dst,src,230400); // ( 320*240*3 = 230400)

		SDL_UnlockSurface(video);
	}
	SDL_UpdateRect(video, 0, 0, 0, 0);

// ----

…Kenneth “fessor” Christensen

Hi !

but my problem is that I only get 20 fps on a K6-2 350 and 60fps on a Cel
466 BOTH running with a TNT2 under windows … have i made a serious error
somewhere in my “Copy-from-array-to-screen”-routine or ?

          memcpy(dst,src,230400); // ( 320*240*3 = 230400)

BTW You don’t care about the pitch of your surface.
BTW2 3202403 is evaluated once at compile time

But this doesn’t explain your framerate. How did you init video system ?
Bouble buffering ? I think you don’t and giving It’s very slow to write in
video memory you get bad perfs.

  tof

I know it’s bad etics to just assume that the video buffer doesn’t have any
pitch … and i’ll fix it later…

btw… just solve my crappy fps problem… remembered that during the old days
my DirectX3 demos would NEVER run on the TNT series…

the TNT and TNT2 doesnt support 24bit resoloutions… i just changed my
display to 32 bit and its now running 41 and 140 fps :wink:

just gotta convert all my routines to 16 bit instead, that should give me
even more speed…

…Kenneth “fessor” Christensen> ----- Original Message -----

From: owner-sdl@lokigames.com [mailto:owner-sdl at lokigames.com]On Behalf
Of Grand Christophe
Sent: Wednesday, June 06, 2001 12:07 AM
To: sdl at lokigames.com
Subject: Re: [SDL] Fast array->Screen routine…

Hi !

but my problem is that I only get 20 fps on a K6-2 350 and 60fps on a Cel
466 BOTH running with a TNT2 under windows … have i made a serious error
somewhere in my “Copy-from-array-to-screen”-routine or ?

          memcpy(dst,src,230400); // ( 320*240*3 = 230400)

BTW You don’t care about the pitch of your surface.
BTW2 3202403 is evaluated once at compile time

But this doesn’t explain your framerate. How did you init video system ?
Bouble buffering ? I think you don’t and giving It’s very slow to write in
video memory you get bad perfs.

  tof