transparency of background of surfaces

mskeel

Senior Contributor
Joined
Oct 30, 2003
Messages
913
I have a list of points for multiple lines. Each line could be hundreds of points long and there could be hundreds of lines. I would like to be able to change the colors of the lines and hide/show them instantly on mouse clicks. Becuase there are so many points to draw, the picture takes time to make.

My thought for the color and hide/show problem was to draw each line to its own surface. Copy them all to a backbuffer and then show that (after all the lines are on it) to the screen, the primary surface. This works for the most part. The only problem is that each surface has its background filled in so that only the most recently drawn line (the surface on top) is shown. I know this becuase I can click on the last line and it dissapears showing me another one, the one before/beneath it.

Two questions really.
1. How do I draw just the line on the surface and nothing else (so all lines will be visible when I copy all surface onto the backbuffer)?
2. What kind of memory issues does having many surfaces like this create? (this isn't really a problem, I'm just curious from a preformance standpoint)

Thank you very much.
 
Just make sure you have a surface with an alpha channel. Then when you clear the render target just set transparent color for background (I'm assuming you're rendering to surface).

Anyway a better way of doing this all would be to have a dynamic vertex buffer and streaming in only vertex data you need with correct colors.
 
Back
Top