GrabImage unreliable unless flip is called twice

BlitzMax Forums/BlitzMax Programming/GrabImage unreliable unless flip is called twice

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

@Oddbal
I don't have a problem with grabimage on my PC either, seems to be a problem with certain graphic cards. I have not tried OpenGL as my games use the DirectX driver. I'll have to get the specs, but one of them was an off-the-shelf year old Dell.

Heres the code:
' Test of Grab Image
Graphics 640,480,0
Local myImage:tImage=IB_Image2()
Cls
DrawImage myImage,10,10
Flip

WaitKey




Function IB_Image2:tImage(TXT:String="Hello World")
	Local lWidth:Int,lHeight:Int
	lWidth=TextWidth(TXT)+2
	lheight=TextHeight(TXT)+2	

	Local tWidth:Int,tHeight:Int,X:Int,Y:Int
	Local mImage:tImage=CreateImage(lWidth,lHeight)
	SetClsColor 0,0,0
	Cls
	' put in our text
	tWidth=TextWidth(TXT)/2
	tHeight=TextHeight(TXT)/2
	X=(lWidth/2)-tWidth
	Y=(lHeight/2)-tHeight
	SetColor 50,50,50
	DrawText TXT,X+2,Y+2
	SetColor 255,255,255
	DrawText TXT,X,Y
	' With the two flips below, this code would work on all pc's, not just some.
	' Flip 
	' Flip
	' now Grab the image
	GrabImage mImage,0,0
	Return mImage
End Function



This code would only works on some pcs all the time. If you take out the rems before the flip commands it works all the time, but it looks stupid seeing the drawing going on.