The magic gate to double buffering

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
020200
Posts: 2
Joined: Sun Apr 09, 2006 6:52 am

The magic gate to double buffering

Post by 020200 »

I am really having some troubles with the double buffering.

Is there a way to *directly* print on screen, or to emulate that behaviour?

When I want to clear the screen I do it once. But when the screen:flip() is inside the loop everything goes flashy. I surely need the flip to get the actual changes. Is there a way to clear both buffers at the same time or to copy the contents into both buffers at once? (I want to avoid a for-loop for this purpose). What's the best way to do it?

This could maybe working by making a copy of the *buffered* screen? But how can I do that?
KcDan
Posts: 13
Joined: Tue Jan 24, 2006 7:58 am
Location: Delaware
Contact:

Post by KcDan »

Ok, lets say that right now Screen 1 is in view. You want to edit to it so flip it so that your able to edit it right now, then when your done with it flip it again.

Code: Select all

while TRUE do
 screen.flip()--Put your screen into the editing one..e.e;
    --Do your editing here
 screen.flip()--Put your screen back
 screen.waitVblankStart()--Wait for it to refresh
end
DiabloTerrorGF
Posts: 64
Joined: Fri Jul 15, 2005 11:44 pm

Post by DiabloTerrorGF »

Wouldn't that make the screen flash?
JorDy
Posts: 121
Joined: Sun Dec 11, 2005 8:45 am

Post by JorDy »

the code should actually be

Code: Select all

while TRUE do
 screen.flip()--Put your screen into the editing one..e.e;
    --Do your editing here
 screen.waitVblankStart()--Wait for it to refresh
 screen.flip()--Put your screen back
end
but if changing the image alot like as in a paint aplication you tend to get some flickers
KcDan
Posts: 13
Joined: Tue Jan 24, 2006 7:58 am
Location: Delaware
Contact:

Post by KcDan »

...
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

You are aware that you can save your screen to an image, (and screen.blit it to the buffer image so when you screen.flip for the first time.. it takes you to a non flicker state.

you should use it that way, it slows down the processing a bit though.

Or you could always learn to limit your FPS so it doesnt flicker.
DiabloTerrorGF
Posts: 64
Joined: Fri Jul 15, 2005 11:44 pm

Post by DiabloTerrorGF »

I really don't see a reason to not use the double buffer unless I am missing something... it shouldn't have any bade effects by using it...
Post Reply