CopyBuffer()
-
- New User
- Posts: 9
- Joined: Thu Jul 10, 2003 3:13 pm
- Location: Germany
CopyBuffer()
If you don't want to "Flip" the buffers wit FlipBuffers(), so that the backbuffer gets exchanged with the frontbuffer, you could create a command like CopyBuffer() which "copy" the backbuffer to the frontbuffer, so that the backbuffer keeps unchanged for the next drawing sequence. Sometimes it may be useful.
Isn't that what FlipBuffers() does?!?
It's the ClearScreen() that actually erases the backbuffer...
Try dong a FlipBuffers() and don't ClearScreen() after it, and see what happens...
Or am I way off here?!? (haven't actually tried it myself)
It's the ClearScreen() that actually erases the backbuffer...
Try dong a FlipBuffers() and don't ClearScreen() after it, and see what happens...
Or am I way off here?!? (haven't actually tried it myself)
AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
-
- New User
- Posts: 9
- Joined: Thu Jul 10, 2003 3:13 pm
- Location: Germany
No, i tried it already. Example: Draw one Line of Text, then do FlipBuffer(). Now draw a second Line of text and FlipBuffer() again. Now you see only the second line. After the next FlipBuffer() you see just the first Line. And so on... In a code from me, I made an loading-Info-Procedure, which shows you, what actually happens in form of an expanding list. What I have to do is: DrawText("test") : FlipBuffer() : DrawText("test") : FlipBuffer(), so that for the next Line the Text is in the Backbuffer too.
oh, ok.. I'll take your word for it...
I guess I really should try the advice I give...
I guess I really should try the advice I give...

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
FlipBuffers() funtion doesn't copy anything, it just flips the screen buffers: the one which was rendered will be displayed, and the one which was displayed will be prepared to be rendered; that's all.
What KuschelTeddy82 requests, could be done using GrabSprite() (to capture all the screen buffer info) and DisplaySprite() (to display all it again)

What KuschelTeddy82 requests, could be done using GrabSprite() (to capture all the screen buffer info) and DisplaySprite() (to display all it again)

I repeat:
but maybe it doesn't have the same effect on every machine/system ?
and i insist:t seems flipbuffers() works as KuschelTeddy82 says in fullscreen, and works as a "copybuffer()" in windowedscreen...
Code: Select all
InitSprite()
OpenScreen(400,300,16,"coucou")
StartDrawing(ScreenOutput())
Locate(200,140)
DrawText("coucou")
StopDrawing()
InitKeyboard()
Repeat
ExamineKeyboard()
If KeyboardReleased(#pb_key_space)
FlipBuffers()
EndIf
Until KeyboardReleased(#pb_key_escape)
Code: Select all
InitSprite()
hwnd=OpenWindow(0,0,0,400,300,#pb_window_screencentered,"coucou")
OpenWindowedScreen(hwnd,0,0,400,300,0,0,0)
InitSprite()
hwnd=OpenWindow(0,0,0,400,300,#pb_window_screencentered,"coucou")
OpenWindowedScreen(hwnd,0,0,400,300,0,0,0)
StartDrawing(ScreenOutput())
Locate(200,140)
DrawText("coucou")
StopDrawing()
InitKeyboard()
Repeat
ExamineKeyboard()
If KeyboardReleased(#pb_key_space)
cnt+1
StartDrawing(ScreenOutput())
Locate(0,0):DrawText(Str(cnt))
StopDrawing()
FlipBuffers()
EndIf
WindowEvent()
Until KeyboardReleased(#pb_key_escape)
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
OK, I will repost in bug section.Your first code demonstrates that FlipBuffers() doesn't copy anything, as said. The second shows a FlipBuffers() bug for WindowedScreen.
*edit* Ah, you did

Another way may be to render on a screensized sprite, using "usebuffer()",and to display that buffer-sprite just before flipbuffers().
What KuschelTeddy82 requests, could be done using GrabSprite() (to capture all the screen buffer info) and DisplaySprite() (to display all it again)
But that doesn't work with displaysprite3D().
-
- New User
- Posts: 9
- Joined: Thu Jul 10, 2003 3:13 pm
- Location: Germany
Uhm... GrabSprite then DisplaySprite to "Copy" is not really good! It would be a damn loose of Speed! All the workaround isn't the way it should be in a fast language like pb. But you see, FlipBuffers() does unusefull flipping of the buffers. With a additional CopyBuffers() you are not forced to render everything in every cycle again, just adjust changes and copy again. In some cases this is a useful way, or do anybody know, for what you could use the 2nd last image
Or Modify the FlipBuffers() to: FlipBuffers([mode, [clipX1, clipY1, clipX2, clipY2]]). So, when you use just FlipBuffer() it acts like we know it. But as mode you can optionally select for example 0 (Standard - Flip), 1 (Copy) and then, if you use copy as mode, you can select a clipping region, which part of the screen should be copied in the frontbuffer.
So, what you think about it?

Or Modify the FlipBuffers() to: FlipBuffers([mode, [clipX1, clipY1, clipX2, clipY2]]). So, when you use just FlipBuffer() it acts like we know it. But as mode you can optionally select for example 0 (Standard - Flip), 1 (Copy) and then, if you use copy as mode, you can select a clipping region, which part of the screen should be copied in the frontbuffer.
So, what you think about it?
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
KuschelTeddy82;
I suggest to you to try "spriteEx" library, from Moebius. You can download it from www.purearea.net for example.
I was trying with it, and there are a useful command to copy a screen rectangle from a coordenate to another; that command takes about 4/5 time units than execute just a GrabSprite() PB command.
That lib has lots of improvements that i guess you will enjoy.
In my opinion, it would be needed for PB to add some argument to FlipBuffers() in order to erase or not to erase the content of buffers.
Besides, I requested Fred about to implement single and triple buffer, and perhaps quadriple buffer, and he said he will add it to PB. With single buffer, in execution time, what is drawn is shown in real time (no flipping buffers). You can do this now with SpriteEX lib
I suggest to you to try "spriteEx" library, from Moebius. You can download it from www.purearea.net for example.
I was trying with it, and there are a useful command to copy a screen rectangle from a coordenate to another; that command takes about 4/5 time units than execute just a GrabSprite() PB command.
That lib has lots of improvements that i guess you will enjoy.

In my opinion, it would be needed for PB to add some argument to FlipBuffers() in order to erase or not to erase the content of buffers.
Besides, I requested Fred about to implement single and triple buffer, and perhaps quadriple buffer, and he said he will add it to PB. With single buffer, in execution time, what is drawn is shown in real time (no flipping buffers). You can do this now with SpriteEX lib
-
- New User
- Posts: 9
- Joined: Thu Jul 10, 2003 3:13 pm
- Location: Germany
I know the SpriteEx-Library already and have it too, but I miss the Sprite3D-Commands there, which I need very often. Jeah, an erase - or not erase option is really needed, and the thing with tribble-buffering
sounds really nice!!!
Uhm.... I know single, double and triple buffer, and I know for what they are, but for what could anyone need quadriple buffer ??? Is one a fixed buffer, on which you can draw graphics which would not change during a game and the other three act like tribble buffering?
Thanks for reporting this things to fred :roll:


Uhm.... I know single, double and triple buffer, and I know for what they are, but for what could anyone need quadriple buffer ??? Is one a fixed buffer, on which you can draw graphics which would not change during a game and the other three act like tribble buffering?
Thanks for reporting this things to fred :roll:
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Mmmmh! should be good if S. Moebius upgrade his SpriteEx lib to 3D sprites... :roll:

Well, when i wrote my request: viewtopic.php?t=8037 , i saw there the very nice Fred's explanation about how triple buffer works, and watching it i realized that quad-buffer should work for those slower PC systems when there is needed lots of calculations before to vblank time is finished. But i don't know if Fred will add quad-buffer... :roll:for what could anyone need quadriple buffer ??? Is one a fixed buffer, on which you can draw graphics which would not change during a game and the other three act like tribble buffering?
