SDL_GL Performance problem

Hi there.

I am currently developing a Slicks’n’slide inspired
bird-view car racing game called CrunchRace. It
uses SDL_GL-functionality to render all graphics
and SDL_mixer for sound effects.

I am targeting Windows (specifically WinXP right now
since that’s the only platfrom that I am able to
test it on). Here is the URL:

http://www.mdstud.chalmers.se/~objarni/crunchrace/index.html

It is in video mode 320x240, 32 bit, to get the right
retro feeling. :slight_smile:

I am experiencing quite a dramatic slowdown when the
cars simultaneously “make trails” ie. slides over
eg. ice. I gather this comes from the gl command
glTexSubImage2D which I use to update the background
texture.

The rendering is done like this:

clear background using glClear
draw background texture glBindTexture, glBegin …
draw car textures same

… and whenever a car makes a trail I use
glTexSubImage2D to update the background texture using
only a 1x1 subimage – code which is placed in the car’s
game logic procedure.

I have read at several occasions on this mailing list
that reading AGP memory is prohibitively slow, but
I am not reading but writing to gfx-mem, am I? And
quite a little also: 1x1 pixels in 32 bit format
should be 4 bytes, correct? Even when four cars slide
with every tire, it would be 444 = 64 bytes, a
raindrop in hell so to speak, even if there is some
overhead in this texture update procedure, which brings
it up to a [small] multiple of 64 bytes to send from
system memory to graphics memory.

Is there something I am missing here? I have queried
SDL for hardware acceleration information, which gives
me the following output, so it does not seem to be
a [driver-related] configuration problem: (me textures
are stored in RGB (24bit) format in AGP, and the video
mode is 32 bit as mentioned above, a no-cost difference
I hope)

Hardware acceleration information ***
Available video memory: 30448
Hardware surfaces createable: Yes
Hardware->hardware blit: Yes
Hardware->hardware colorkey blit: Yes
Hardware->hardware alpha blit: No
Software->hardware blit: Yes
Software->hardware colorkey blit: Yes
Software->hardware alpha blit: No
Solid rectangle draw: Yes

Also, asking gl if my textures are resident (ie.
placed on AGP chip mem, not system memory in gl lingua)
prints:

Blue car resident: yes
Green car resident: yes
Pink car resident: yes
Background resident: yes

Thankful for any help,

/Olof

Hi!

Am Donnerstag, 14 August 2003 schrieben Sie:

I am experiencing quite a dramatic slowdown when the
cars simultaneously “make trails” ie. slides over
eg. ice. I gather this comes from the gl command
glTexSubImage2D which I use to update the background
texture.

Hi,
actually i couldn’t see the slowdown because in the version you have
for download there is only one car racing. And I did not find a way
to get any other cars started.

BTW, there seems to be a bug in your input handling code. For the
accelleration key you only seem to be tracking keydown events instead
of keydown for “accelerate” and keyup for “stop accelerion”.

Matthias

My mistake, should’ve described the controls in case you would try to
see the slowdown!

To begin with, the controls are somewhat obscure or at least
inconsequent right now, due to my fanatic strive to minimize keyboard
usage (hate keyboards when it comes to many-players-on-one-computer!
Why don’t we all have two game pads hooked to our PCs?)

You turn on/off the gas by pushing arrow up.
If you have no gas, arrow down means reverse.
If you have gas, arrow down means handbrake.
Left/right at last is used the way you would
normally think they were used :slight_smile:

The same goes for the other two cars:

1: gas on/off
2: reverse/handbrake
a/d: left/right

g: gas on/off
h: reverse/handbrake
j/l: left/right

Btw. I am on a AMD700 with a GeForce2, if you have much newer I guess
you would find it hard to mimic the behaviour I describe. And if you
have a joystick, one of the car will (hopefully) be controlled by it,
skipping one of the above keyboard controls.

/Olof

Matthias Bach: “Re: [SDL] SDL_GL Performance problem” (2003-08-14 08:28)

#Hi!#
#Am Donnerstag, 14 August 2003 schrieben Sie:

#> I am experiencing quite a dramatic slowdown when the
#> cars simultaneously “make trails” ie. slides over
#> eg. ice. I gather this comes from the gl command
#> glTexSubImage2D which I use to update the background
#> texture.

#Hi,
#actually i couldn’t see the slowdown because in the version you have
#for download there is only one car racing. And I did not find a way
#to get any other cars started.

#BTW, there seems to be a bug in your input handling code. For the
#accelleration key you only seem to be tracking keydown events instead
#of keydown for “accelerate” and keyup for “stop accelerion”.

#Matthias

#_______________________________________________
#SDL mailing list
#SDL at libsdl.org
#http://www.libsdl.org/mailman/listinfo/sdl