forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The magic gate to double buffering

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
020200



Joined: 09 Apr 2006
Posts: 2

PostPosted: Sun Apr 09, 2006 7:25 am    Post subject: The magic gate to double buffering Reply with quote

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?
Back to top
View user's profile Send private message
KcDan



Joined: 24 Jan 2006
Posts: 13
Location: Delaware

PostPosted: Sun Apr 09, 2006 12:33 pm    Post subject: Reply with quote

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:

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
Back to top
View user's profile Send private message Visit poster's website AIM Address
DiabloTerrorGF



Joined: 15 Jul 2005
Posts: 64

PostPosted: Sun Apr 09, 2006 2:55 pm    Post subject: Reply with quote

Wouldn't that make the screen flash?
Back to top
View user's profile Send private message
JorDy



Joined: 11 Dec 2005
Posts: 121

PostPosted: Sun Apr 09, 2006 7:55 pm    Post subject: Reply with quote

the code should actually be
Code:
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
Back to top
View user's profile Send private message
KcDan



Joined: 24 Jan 2006
Posts: 13
Location: Delaware

PostPosted: Mon Apr 10, 2006 1:56 am    Post subject: Reply with quote

...
Back to top
View user's profile Send private message Visit poster's website AIM Address
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Mon Apr 10, 2006 7:50 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
DiabloTerrorGF



Joined: 15 Jul 2005
Posts: 64

PostPosted: Mon Apr 10, 2006 7:53 am    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group