cubes + clear black edges



Hi,
basically I want to draw a set of cubes, e.g. in red, and redraw the
edges so that each cube is clearly visible - look a little bit like
LEGO. That kind of works already, so a cube is drawn, it is shaded and
so on, that was all easy, I draw a set of lines after the cubes around
the cubes for the edges.

So that looks good now for one cube, but if I draw multiple cubes and
some of them form a plain area, because they got the same height and
are adjacent, the lines become hardly visible (dotted and so on) and
sometimes even totally disappear. Currently I just use a set of lines
that I draw in black and I assume that the Z-Buffer or so makes them
disapear if one cube is close to be in front of a line to be drawn.

So my question is: how can I draw always clear and visible edges for my
objects? even if they are next to each other and so on?

.