screen flicker with graphics cls/flip/cls

BlitzPlus Forums/BlitzPlus Programming/screen flicker with graphics cls/flip/cls

gerald(Posted 2011) [#1]
Hi,

When loading a background, hud, sprite and effect I get a black screen instaniously with each cls/flip/cls. Can this be smoothed out so I can load and clean 8 screens with no blank screen effect?

I tried cls/flip/load/cls/flip/load and it flickers like twylight. (sp)

Can I adjust framerate or something?

Gerald


H&K(Posted 2011) [#2]
http://www.blitzbasic.com/bpdocs/command.php?name=SetBuffer&ref=2d_cat

I dont have BPlus, so just signpost help

Last edited 2011


xlsior(Posted 2011) [#3]
When you CLS and then Flip, you're essentially clearing the screen first and then immediately display the blank page.

Normally you would:

1) cls (clear the old info, which is in an indeterminate state)
2) draw (load/draw/whatever everything you want to be visible)
3) flip (to make it visible)


Matty(Posted 2011) [#4]
Note cls is not necessarily required eg-

If you are always drawing a backdrop (static or otherwise) that fills the entire screen first then there is no point to cls.


gerald(Posted 2011) [#5]
Hi,

I didn't try cls/load/flip yet. You load to the back buffer and clean the screen, can you then clean the backbuffer and then load it so you never have to flip a blank screen up? Do cls/load/flip and clean backbuffer/load so the next flip is loaded on a cleaned buffer. I have ghost images from my previous images, especially neon colors.

thanks,
Gerald


Floyd(Posted 2011) [#6]
Cls is a traditional name in Basic, meaning Clear Screen. But in Blitz it really means Clear the current default graphics buffer. This could be the Front or Back buffer, or an image buffer, or even a texture if you were using Blitz3D.

You normally want to draw to the back buffer. When everything has been drawn you Flip to make it visible, i.e. it becomes the front buffer. The main part of your program would then have this structure:
SetBuffer BackBuffer( )  ; you might already be using the back buffer, but let's make sure
Repeat
   Cls
   Draw everything
   Flip
Until you want to quit



H&K(Posted 2011) [#7]
ok, CLS will clean whatever "buffer is current", so if its set to the back buffer cls clears that. So..

Cls, Draw, Flip

Cls, Would clean the (Draw)back buffer,
Draw Would draw on the (draw)Back buffer,
Flip would swap them over (Swap Buffers)

It is possible to use JUST the draw bit (Straight to front buffer), but why bother?