This topic is now archived and is closed to further replies.


What is the easiest way to implement scanlines?

Recommended Posts

Guest Anonymous Poster
You have a structure of lists of buckets. So you have a list of polygons to render for each scanline or pixel-line.

After you do the final transformation to get your polygons into screen space. You place each polygon into its respective bucket list. To determine how a polygon gets placed into a bucket is the determined by the polygons highest y (height/pixel) value, it is in screen space. You may have a hash function that does the appropriate math to get the actual pixel value. Once you have all your scenes polygons into buckets you then start at the top of the screen..scanline 0 and start drawing. For each scanline you place its entire bucket into an active draw list. You then traverse this list to draw your scene. When a polygon is done being drawn it is removed from this active list. To draw a polygon you must keep track of the incremental values down the lengths of the polygon.

You can put the resultant image data into a Bitmap or RGB image very easily. Those file formats are really easy.

Share this post

Link to post
Share on other sites