Page 1 of 1

Screen refresh

Posted: Fri Jun 03, 2005 12:34 am
by Dom Red
can someone help me, how can I stop the screen flickering :oops:

Posted: Fri Jun 03, 2005 1:17 am
by Levi
Ummmm....there was this packet balled QBME that I downloaded once. It had something on flicker free animation. It went into topics like screen pages, copying a background page to the visible page to eliminate flicker. And waiting for the screen refresh before clearing and changing graphics.

Ah, I think I had originally found it at qbasic.com in it's files section. Let me see if it's there.

Nope, not there. Hmmm....Oh wait...Yup I was right. On the site QB45.com just go to their tutorials section and look under graphics. The sprite, Mallard, and flicker tutorials are all good ones to learn from. As well as the many others.

Posted: Fri Jun 03, 2005 5:52 am
by Pete
Here's a short tutorial that will probably answer your question:
Waiting For the Verticle Retrace
-HAL_8900

I know every single person out there has at one time download some QB-Game that has TERRIBLE flicker. This is caused by the program running too fast for the monitor to keep up...
there's one simple way to eliminate this problem..... wait for the verticle retrace on the monitor!

Now, before everyone goes "Ungh? WAIT? I want my program to be FAST!" you need to understand, WAITing for the verticle retrace doesn't slow down the program all that much (after all, it's a hardware thing) and the delay will be imperceptable (sp?). Also, you can add this without having to rewrite your entire program.... here's and example:

Code: Select all

SUB ANIMATE
DO
WAIT &H3DA, 8
PUT (x,y), sprite<----Assuming that sprite has already been BLOADED and GET-ed(GET-ed ehehe)
x=x+1
LOOP
Now, of course, with this program, you'll have a long line of sprites when you run it, but implement the command:

Code: Select all

WAIT &H3DA, 8
on any animation thats flickery and it should stop (or reduce) the flicker....

Now, this wont ALWAYS work...

On really fast machines, this algorithm will work sometimes, at best, but on 486's and Lower-End (66mhz-120 mhz) pentiums, this will produce fantastic results!

YUP! THAT'S IT!!!!!

Posted: Fri Jun 03, 2005 2:15 pm
by Deleter
thats the method I use, but I have a real fast computer and it still flickers a bit...is there any solution for this?

Posted: Fri Jun 03, 2005 4:16 pm
by Xerol
Well, if possible, use FreeBasic, which has inherent page-copying, and therefore flickerless graphics.

Posted: Fri Jun 03, 2005 5:14 pm
by Deleter
I am using freebasic. and I am using the screenset command<-bad idea?

edit: damn...screencopy does eliminate flicker....but it also cuts my fps...help?

Posted: Fri Jun 03, 2005 6:03 pm
by Xerol
It'd probably be helpful if you posted some code. Take a look at Bombard!, and see how that runs. I get around 101 fps most of the time, and wrote a little function to handle the screen copying, clearing the keyboard buffer, and displaying the current FPS.