This code "jitters" full-screen / steady in window

Blitz3D Forums/Blitz3D Beginners Area/This code "jitters" full-screen / steady in window

Orgull(Posted 2005) [#1]
Hi there. Again.

I'm running the following code and getting different results in fullscreen mode from windowed mode.

(P.S. How do I put my code in a snazzy box like I see others doing? Thanks!)

*****
Graphics 1024,768,32,1
SetBuffer BackBuffer()

SeedRnd MilliSecs()

While Not KeyHit(1)

count# = MilliSecs()
.pattern1
Color Rnd(0,255),Rnd(0,255),Rnd(0,255)
Plot Rnd(0,1023),Rnd(0,767)
If MilliSecs()-count# < 1000/60 Then Goto pattern1

VWait: Flip False

Wend
*****

Okay, when I run it as is, I jet a jittery effect in fullscreen mode, but when I change the first line to:

Graphics 1024,768,32,0

the code works just fine, no jitters, nice and steady.

(note this is all with debug mode on of course)

Why the jitters in fullscreen and not in windowed mode? Any thoughts?


Ross C(Posted 2005) [#2]
might be to do with the fact your doing:

VWait: Flip False


If your wanting to sync the fps top the monitor rate, just use flip true :o)

oh, and for the snazzy code box:

[ code ]

code here!

[ /code ]

without the spaces tho between the brackets.


Andy(Posted 2005) [#3]
Use the code archives, there is a surprising amount of wonderful code.

Here's some frame limiting code for you. Frame tweening will allow your graphics to render as many frames per second as possible while running your game logic a fixed number of times a second.

http://www.blitzbasic.com/codearcs/codearcs.php?code=9

Andy


sswift(Posted 2005) [#4]
Your video card might be forcing vwait on? Check the display config panel.


Orgull(Posted 2005) [#5]
Ok I checked my display properties. Vsync is "application preference" as I thought. So that's not the problem.

I have tried Vwait: Flip False, Vwait: Flip True, Flip False, Flip True and finally just Flip. I get jitters in fullscreen using any of these, but not in windowed mode. So that's not the problem.

In fact I get jitters with EVERY program I write in BB3D that uses fullscreen mode instead of windowed mode. Whether I use frame-limiting, or no timing at all... So that's not the problem.

Since my code runs rock steady in windowed mode, I have to assume this is a display settings issue. BTW I have no problems with DBPro programs in fullscreen mode (but my god the sound problems) so this is specific to BB3D, I'm sure.

BTW, when setting fullscreen, is there a way to select fullscreen exclusive mode? I wonder if BB is using Windowed Fullscreen mode...


Orgull(Posted 2005) [#6]
Well crap... I disabled debug mode and in mode 0 the problem goes away... must have been something in the debug mode causing my troubles.

Thanks for all the help!


sswift(Posted 2005) [#7]
Debugging slows stuff down.

Running in windwed mode generally runs at a lower res and will run faster so have less ghosting.


Oddball(Posted 2005) [#8]
The flickering is due to the back buffer and front buffers having different images upon them. Basically you are drawing some pixels to one buffer, flipping the buffers, then drawing pixels to a different buffer. This creates two images that are not identical and hence appears to 'jitter'. The following code should do what you are trying to achieve without the jitters.



Ideally this code should just draw straight to the front buffer, but I was just illustrating a point.


Ross C(Posted 2005) [#9]
Try avoid using goto instead your code :o)

The above code with a loop in it instead.

Graphics 1024,768,32,0

SetBuffer BackBuffer()

SeedRnd MilliSecs()

While Not KeyHit(1)

count# = MilliSecs()

Repeat
   Color Rnd(0,255),Rnd(0,255),Rnd(0,255)
   Plot Rnd(0,1023),Rnd(0,767)
Until (MilliSecs()-count#) > (1000/60.0)

CopyRect 0,0,1024,768,0,0,BackBuffer(),FrontBuffer() 

Wend