A.D.A. Amiga Demoscene Archive

  Welcome guest! Please register a new account or log in




log in with SceneID


Demos Amiga Demoscene Archive Forum / Coding / Drawing objects with blitter and cpu


Author Message
#1 - Posted: 29 Jul 2011 19:59
Reply Quote

I have been studying up on my trigonometry so that I can hopefull rotate some objects (3D ones I hope) in my demo, but I have a few questions:

1) How long does the blitter take to fill an object and can it be worked out from the size of the area to be filled?

2) Is it best to use the blitter for drawing and the cpu for all the maths, or do the maths first and use the cpu and blitter for drawing?

Target machine is A600 (68000 CPU, ECS hardware with 2MB RAM).

#2 - Posted: 29 Jul 2011 21:19 - Edited
Reply Quote
On 68000, the blitter will be quicker for drawing lines. To draw lines with the blitter that will work correctly with blitter area fill you need to use a couple of tricks - all lines need to be drawn in either an upward or downward direction and you have to point the C channel to the screen and the D channel to a scratch area. This is so the first (or last, can't remember which...) pixel of a line gets dumped off to the scratch area. You also need to set the lines drawn to the mode where the blitter only draws one pixel per row on the horizontal.

Drawn like that objects can be filled correctly with the blitter.

You've probably got my line draw code from code I posted on EAB - it works fine for blitter filling objects.

If I remember right, filling works at the same speed as the blit you're doing so if you're doing a straight A to D copy blit for your fill it'll be the same speed as that A to D copy would be without the fill although I could be wrong on that... The bigger the area filled, the longer it will take. Blitter speed is as per the description in the HRM.
#3 - Posted: 2 Aug 2011 08:50
Reply Quote
Or use HAM mode to fill your linedrawn object :)
#4 - Posted: 14 Aug 2011 21:37
Reply Quote
That's one dirty trick you got there, Boogeyman. :)

I guess the tricky part is handling the case where lines cross or partially coincide.

Has it been used in any demo that you know of?
#5 - Posted: 15 Aug 2011 11:42 - Edited
Reply Quote
Dirty? Perhaps.. fun? Hell yeah :)

And you're right, I spent a lot of time avoiding filling bugs.

I've searched my mind, and I simply can't remember who did it first. I saw this one demo with a huge filled cube where the sides were split up into 2 differently coloured triangles.

I knew it couldn't be filled with the blitter (too big a fill area to run 50fps), and the coder hinted something along the lines of "Don't try this with the blitter at home kids" .. I think the demo also had some fireworks dot effects, but I could easily be mixing things up.

Anyway, I used the trick in my "Last A500" from when I was in Oblivion.. must be from around 1993 or so.

Most feasible usage of the trick is to draw BIG, simple convex objects iin HAM5 and lose the blue colour component. As you only linedraw, you can clear your buffers by re-drawing in EOR mode.


  Please register a new account or log in to comment





A.D.A. Amiga Demoscene Archive, Version 3.0