gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Graphic distortion caused by OBJ <> OBJ <> BG pr

#110282 - Peter - Mon Nov 27, 2006 3:00 pm

Hi all,

one of the HEL Library users sent me a test project where some OBJ's are distorted. The distortion is only visible on the display, the OBJ's look good in the tile-viewer as well as in the OAM viewer. BTW, only VBA emulated the problem correctly, no$gba does not, will Martin drop an email later.

I replaced the graphics and uploaded the compiled test project, you can check it out here. Move the monster over the text and the letters will distort. I was pretty stuck until I found this text in GBATek (url fixed, points not to my HD anymore):
Quote:

Priority

In case that the 'Priority relative to BG' is the same than the priority of one of the background layers, then the OBJ becomes higher priority and is displayed on top of that BG layer.

Caution: Take care not to mess up BG Priority and OBJ priority. For example, the following would cause garbage to be displayed:
OBJ No. 0 with Priority relative to BG=1 ;hi OBJ prio, lo BG prio
OBJ No. 1 with Priority relative to BG=0 ;lo OBJ prio, hi BG prio

That is, OBJ0 is always having priority above OBJ1-127, so assigning a lower BG Priority to OBJ0 than for OBJ1-127 would be a bad idea.


The red marked text is exactly what he is doing in the test project, so this seems to be some sort of hardware limitation or bug?! Does anybody know why this occurs or is it more like "that's a fact, simply don't do it"? :)


Last edited by Peter on Mon Nov 27, 2006 9:33 pm; edited 3 times in total

#110287 - Cearn - Mon Nov 27, 2006 4:37 pm

As it doesn't seem to be a problem for it can probably be considered a GBA hardware bug/oversight. From a GBATek not on your HD:
Quote:
DS OBJ Priority
The GBA has been assigning OBJ priority in respect to the 7bit OAM entry number, regardless of the OBJs 2bit BG-priority attribute (which allowed to specify invalid priority orders). That problem has been fixed in DS mode by combining the above two values into a 9bit priority value.