I think it’s pretty overdoing to use a 3d api to draw lines Have
you tried Bresenham on a software-surface? I’d advice to keep your
backbuffer in software for faster acces.
That’s precisely what I’m doing, and I’m also writing directly to the
in system memory backbuffer surface. It’s a Bresenham algorithm.
I’ve tried doing dirty tiles, but on faster machines it’s slower than
just doing a single blit of the entire backbuffer to the display
surface. I’m getting roughly 80FPS on a Pentium III 1Ghz, and I have
yet to add line clipping, background tiling, and antialiasing, so
obviously I’m looking to make things really fast. The antialiasing I
fear will have a great impact on performance, so I’m doing as much
front optimization as possible. WU Antialiasing is the approach I’m
going to use as it seems to be the fastest antialiasing algorithm
around.
I think you’re looking for the performance issues in the wrong place. If
you profile your application, I’m about 90% sure that you’ll find that
most of the time is spent in SDL_FlipSurface(), or whatever you use to
blit the back buffer to the screen.
I’m dealing with 400+ vectors PER FRAME, so even the smallest
optimizations are significant.
I don’t think so. Your CPU has about 31250 cycles to render each line.
Depending on your application and screen resolution, that’s probably in
the range of 50-500 cycles per pixel of each line.
You think there is a problem!?
Well, there is: Getting the result into VRAM…
Check out SDL_Draw, although
i’m not sure what kind of algoritm they use and if they do it smart
(lock, draw all pixelds, unlock) and not calling a dedicated putpixel
function. It’s here:
I took a look at it, and it seems like it’s intelligent. However, I
didn’t see an optimizations for horizontal, vertical, or 45 degree
angles, though I must say I didn’t spend a bunch of time in the code.
It might be because there isn’t much point in such optimizations (unless
possibly for the horizontal case), when the algo is totally memory bound
on any but the slowest still working PCs you can find today.
My code is already as optimized (if not moreso) than it is, but at
least it lets me know I’m on the right track.
I may just have to make assembly versions of the linedraw routines…
Don’t bother. You’ll need to spend serious time on it to beat the
compiler, and you’re still memory bound.
//David Olofson - Programmer, Composer, Open Source Advocate
.- Coming soon from VaporWare Inc…------------------------.
| The Return of Audiality! Real, working software. Really! |
| Real time and off-line synthesis, scripting, MIDI, LGPL…|
-----------------------------------> (Public Release RSN) -' .- M A I A -------------------------------------------------. | The Multimedia Application Integration Architecture |
----------------------------> http://www.linuxdj.com/maia -’
— http://olofson.net — http://www.reologica.se —On Wednesday 02 October 2002 09:15, Neil Bradley wrote: