setbuffer problems

Blitz3D Forums/Blitz3D Programming/setbuffer problems

tsmpaul(Posted 2015) [#1]
Hi guys, I've encountered a problem today which I haven't had before, and I'm a bit confused as to what is going on. The SetBuffer command doesn't seem to be working for me anymore. If I write this:

Graphics 640, 480, 32, 2
SetBuffer BackBuffer()
Text 10, 10, "Invisible Text"


If I run it, nothing should happen on my screen right? Because there is no Flip command to flip the text to the front buffer? But on my computer now, the backbuffer command is being ignored, and everything just comes straight onto the screen as if it had been flipped... Am I writing the code wrong here, or is it supposed to be invisible like I think it is until it is flipped?
I recently updated to Windows 10, so could this be a Win 10 conflict of some kind?


RGR(Posted 2015) [#2]
If you put a Delay after Graphics you'll see it works...

Action comes too fast while it is still building the window.
It writes on the screen before setting the buffer is complete ... I would say.

Change Delay(1000) in Line 2
20 is too low; 50 is too low on my computer. I must at least give 100 millisecs time to establish the window before it works.

Graphics 640, 480, 32, 2
Delay(1000)
SetBuffer BackBuffer()
Text 10, 10, "Invisible Text"
WaitKey()
Flip()
For i= 1 To 5
	Cls
	Text 10,10, Str(i)+ " Backbuffer "+CurrentTime()
	Delay(1000)
	Text 10,30, Str(i)+ " Backbuffer "+CurrentTime()
	Delay(1000)
	Text 10,50, Str(i)+ " Backbuffer "+CurrentTime()
	Delay(1000)
	Flip()
	SetBuffer FrontBuffer()
	Text 10,70, "Writing to the frontbuffer after flip "+CurrentTime()
	Delay(1000)
	Text 10,100, "Writing to the frontbuffer again (no flip) "+CurrentTime()
	Delay(1000)
	Text 10,130, "Writing to the frontbuffer again (no flip) "+CurrentTime()
	Delay(1000)
	SetBuffer BackBuffer()

	If KeyHit(1) Exit
Next




tsmpaul(Posted 2015) [#3]
Thanks for the tip! Now I've got things working properly.


RemiD(Posted 2015) [#4]
Related to this, is there a difference (what happens and what is displayed on screen) between :

setbuffer(backbuffer())
renderworld()
text(0,0,"hello world !")
vwait():flip(false)


and

setbuffer(backbuffer())
renderworld()
text(0,0,"hello world !")
copyrect(0,0,graphicswidth(),graphicsheight(),0,0,backbuffer(),frontbuffer())
vwait():setbuffer(frontbuffer())