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.

Beginners > Mode4 and sprites problem

#26229 - isildur - Thu Sep 09, 2004 9:22 pm

I searched this forum and read gbatek and cowbite but now I am stumped.

I am using mode 4 and I want to use sprites for displaying text. I don't know if it's a good approach but I already have some raster fonts for this but I thought I could try with sprites instead.

So I managed to load my sprite data at the correct place in vram. (By the way I use double buffering in mode 4).

The problem is that the sprites are displayed behind the bit blitting. I need those sprites at the very topmost. Is it possible? How?

#26230 - DiscoStew - Thu Sep 09, 2004 9:32 pm

I know with Mode 5 people have been able to rotate the frame buffer by using control registers and affine matrix register related to either background 2 of 3 (Please correct me on this, I've never tried that, only heard). If that is true, couldn't you use a control register of either background 2 or 3 to change it's priority? Or maybe you can change the priority on the sprites? Someone else might explain better than I can on the subject, or know exactly how to do it. I'm just putting in my 2 cents.
_________________
DS - It's all about DiscoStew

#26237 - tepples - Fri Sep 10, 2004 12:55 am

The order in OAM determines priority against other sprites. Attribute 2 bits 11-10 determines priority against the background.

If sprites are showing up behind the mode 4 background, then make sure the sprites are first in the OAM display list and drawn at priority 0.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#26249 - isildur - Fri Sep 10, 2004 4:59 am

I did try setting the oam priority but the sprite is always behind my raster drawing.

:(

#26272 - isildur - Sat Sep 11, 2004 12:11 am

Sorry to push but, no replies since yesterday...

Does anybody have an example of sprites in mode 4 when also doing raster operations in vram. Using mode 4 with sprites/tiles only does work.

The problem is when I use sprites and draw stuff like polygons or raster bitmaps.

#26277 - opcode - Sat Sep 11, 2004 2:52 am

I am using mode 4 double buffered. All my sprites are showing up on top of the background. I'm not doing anything special either. So, at the very least I can tell you it's possible, but you probably already knew that.

#26279 - isildur - Sat Sep 11, 2004 4:32 am

Then what could I be doing wrong?

#26280 - DekuTree64 - Sat Sep 11, 2004 4:45 am

I think we need a screenshot and/or some code to figure out what's happening. Just to be sure, you're using sprite chars 512+, aren't you? They shouldn't display at all if you use below that, but it's a common 'gotcha' of the GBA hardware.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#26285 - isildur - Sat Sep 11, 2004 1:39 pm

The sprites display indeed but behind any drawing I do. To show you screenshots, I have to prepare something else because I don't think I can show stuff that will be submitted to the compo.

#26295 - sajiimori - Sat Sep 11, 2004 5:36 pm

If I'm not mistaken, it's impossible for sprites to show up behind any backgrounds if the sprites are set to priority 0. Double and triple check that you are setting them to priority 0 -- decode the OAM by hand if you have to. There is simply no other setting that could cause them to be drawn behind the background -- not even if the background's priority is 0.

#26344 - FluBBa - Mon Sep 13, 2004 2:46 pm

This is a long shot, you don't happen to be using RascalBoy?
I just saw this:
Quote:
Corretto errore priorit?, per gli sprites nella modalit? di disegno 4.

Corrected sprite priority for mode4, Aug 1.
_________________
I probably suck, my not is a programmer.

#26348 - isildur - Mon Sep 13, 2004 4:14 pm

Thanks, I found my bug. I was overwriting the oam priority bits when setting other bits later on. Everything works fine now :)

Sajiimori, thanks for making me double check those bits.