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.
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