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?
The magic gate to double buffering
Moderators: Shine, Insert_witty_name
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
the code should actually be
but if changing the image alot like as in a paint aplication you tend to get some flickers
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
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.
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.
-
- Posts: 64
- Joined: Fri Jul 15, 2005 11:44 pm