Sign in to follow this  

OpenGL mesa triangle rasterizers

Recommended Posts

Hello all!

According to this document:

The origin of the screen is in the lower-left corner and pixel centres are @ half-integer coordinates. Eg. origin is @ (0.0, 0.0) and the first pixel centre in the lower-left corner is @ (0.5, 0.5).

The top-left fill convention is illustrated here:

and here:

Having looked at the mesa triangle rasterizer over the last couple of days I can't fathom why there is a half-pixel offset in (-0.5, -0.5) in x and y at the start of the rasterization...? Can somone explain this? Maybe it's because mesa actually has pixel centres at integer coordinates...

Initially the pixel offset applied to the window coordinates is (0.5, -0.5) in x and y but during span rendering all the pixels within a triangle (or satisfying the top-left fill convention) are actually shifted to the left by 1 pixel. The net effect is a shift in window coordinates by (-0.5, -0.5) in x and y.

This has been puzzling me for a while. Can someone help?

Thanks a lot,

PS Ultimately I'm after looking at a quality fully featured rasterizer that is accurate and comprehensible. I'd like to see another quality implementation asside from Hecker's just for the heck(er) of it! And also because Hecker states on his site that there is an error in his analysis re: actual texture look-up. Maybe Muli3D is worth a look...Is there a doc/code showing correct indexing into texture data?

There's a lot of fixed point rigmarole in the mesa rasterizer that I can follow - yet mesa does not use an error-term DDA for the edge walk. The edge walk in mesa uses 21.11 fixed point and the error-term DDA is used to determine the dc/dx and dc/dy attribute interpolation.

[Edited by - roglet on November 11, 2010 7:24:38 AM]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this