Inclusive, Exclusive?

Started by
-1 comments, last by Cyelince 22 years, 2 months ago
Okay, I''m just posting this because I find it greatly amusing at the number of individuals that have not discovered that many, many rendering or blitting methods use upper-left inclusive and bottom-right exclusive. A good way to test, say if you are in 640x480 resolution, if something is upper-left inclusive, bottom-right exclusive is to... - Make a bitmap, like completely red or something. - Make a line every other pixel vertically and horizontally - Make boarder lines, like a line for the first and last row, first and last column, preferably a different color than the other lines. +-----+ |o|o|o| |-+-+-| |o|o|o| +-----+ Heh, kind of like that! Then blit it across the screen. Make sure that there is no anti-aliasing or anything turned on (if possible with what you are using). If you set you rect for 0, 0, 640, 480 and blit. Then you should see that it turns out well, however, if you set it for 0, 0, 639, 479 then you may see some stretching. If not for the lines it may not be noticable. Also if it''s not stretching it may just not draw the boarder lines. That''s a good test. I know that the upper left inclusive, bottom right exlusive seems dumb and confusing at first, but it''s actually really good in 3D graphics and tile maps and much more... see... left = x; right = x+width; top = y; bottom = y+height; See, that way you do not have to make x+width-1. And with triangles in 3D you can have shared vertices and not waste or skip any pixels. So it''s actually a great idea. And...if you can''t do tests like that...always check the documentation, or you probably should anyway...if you can decipher it. Cocyen

This topic is closed to new replies.

Advertisement