Page 1 of 1

Missing Scanline Glitch

Posted: Sat May 16, 2020 4:11 am
by Metaedge
Hello,

I've encountered a strange glitch in a new project of mine that I was hoping to get help with.

It seems that some of the scanlines near the top of the screen aren't being displayed on certain backgrounds. This tends to get worse as the size of my game arrays increase. Strangely, this glitch has no impact on vram, which is perfect when viewed through VBA's map tool.

The game arrays are stored in sram to avoid soaking up all the ram (even though they really aren't that big with a mere 400 entries).

I'm not sure what's causing this problem, but I'm hoping someone else has encountered this before and can post some advice.

Thanks,
Metaedge

Re: Missing Scanline Glitch

Posted: Thu May 28, 2020 3:30 am
by WinterMute
This is screen tearing caused by updating graphics during screen draw time. It's difficult to offer specific advice without seeing exactly what you're doing but calling VBlankIntrWait immediately before drawing will ensure you're in the vblank period. Make sure to separate your game logic from your graphics updates too so you're not trying to calculate and draw at the same time. i.e. calculate all your player movements/collisions etc in one place before calling VBlankIntrWait then render your graphics appropriately.