Jump to content
  • Advertisement
Sign in to follow this  
roglet

OpenGL mesa triangle rasterizers

This topic is 2804 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all!

According to this document:

http://www.opengl.org/registry/specs/ARB/fragment_coord_conventions.txt

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:
http://msdn.microsoft.com/en-us/library/cc627092(VS.85).aspx#Triangle

and here:

http://chrishecker.com/images/4/41/Gdmtex1.pdf

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,

Roglet.
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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!