GP32 Flickeing Problems


Abitos Schrelb

Still Fresh
Joined
Jan 3, 2004
Messages
16
Age
39
Location
Germany -> Albstadt
Website
www.schrelb.de
so now i have programmed my first game ever
and also my first cpp project.

my game is a small tetris clone.

my problem is, when there are several stones on
the field, and there are also some lines
of status code on the right corner of the display,
the text and the preview stone start flickering.

i have no clue why beacause i use 2 surfaces to flip,
and my cpu runs at 133mhz. i draw everityhing in
cycles of 30ms on the hidden surface and flip it
afterwards.

do you know why it flickers?


will it be bossible to answer my question without the
code? if not i could upload the entire project.

greetings, tobias
 
I'm not exactly sure how the SDK works, but as I understand it, after you call GpSurfaceFlip() the LCD may draw another frame from the old buffer before using the new buffer. That means that if you start drawing into (say) buffer 1 immediately after setting buffer 2 with GpSurfaceFlip, you may get flickering because buffer 1 is still being displayed.

What I've done is triple-buffer, and it gets rid of the problem. You need to get 3 LCD buffers, and draw into them in rotation. Say buffer 1 is currently active and you've just drawn into buffer 2:
1) Call GpSurfaceFlip to make buffer 2 active
2) Draw into buffer 3
3) Call GpSurfaceFlip to make buffer 3 active
4) Draw into buffer 1
...etc.

Good luck, and let us know how you get on!
 
Do you think you need to run at 133mhz? :blink:
Puzzle Mix runs entirely at 40mhz without problems and with only 2 surfaces.
Try another speed as I have noticed that at 16mhz and 66.5mhz, for example, the right side of my screen flickers but not at other speeds.
 
I get flickering artifacts in the right quarter of my screen with my first ever project - actually seems to happen all the time but is more noticable with a large number of sprites at once...

Haven't tried tripple-buffering or adjusting the clock speed - will do so and report back...

/motten
 
just tried tripple and even quad-buffering - doesn't make any difference regarding the weird flickering in the right side of the screen... Looks perferctly fine on the gp32 emulator btw - only flickers on the actual unit...

could this behaviour be caused by GpSurfaceFlip'ing being called too often without doing cpu-intensive stuff in between ? My small testprogram doesn't do anything but draw a number of bouncing sprites using GpBitBlt from an array of structs (id, xpos, ypos. xspeed, yspeed, imgsource) ?

cheers

/motten
 
just confirmed my suspicion that rapid flipping / blitting was the problem - added this:
for (int i=0; i<100000; i++);
to my gameloop and everything is silkysmooth without any flickering.
Problem may go away once I start adding collision detection and physics - otherwise periodically lowering the clockspeed may be the answer ?

cheers

/motten
 
I've also had this problem. After I moved the GpClockSpeed line to gpstart.c my programs seem to work a lot better (no weird graphic glitches on the right side of the screen).

Can anyone explain why/how this works?
 
Back
Top