Blitz3D window mode speedUP

Blitz3D Forums/Blitz3D Programming/Blitz3D window mode speedUP

Kev(Posted 2004) [#1]
Hi

while looking into placing gadgets on top of the blitz runtime window ive came up with a speed increase when using blitz3d in windowed mode.

do you see the speed increase?

.decls

.lib "user32.dll"
apiFindWindow%(lpClassName$,lpWindowName$):"FindWindowA"
apiInvalidateRect%(hWnd%,lpRect%,bErase%):"InvalidateRect"

example

;
RUNTIME_Window$ = "SpeedTest"
AppTitle RUNTIME_Window
runtimewindow = apiFindWindow("",RUNTIME_Window$)

;
Graphics3D 800,600,16,2
SetBuffer BackBuffer()

camera = CreateCamera()
PositionEntity camera,0,0,0

light = CreateLight()

cube = CreateCube()
PositionEntity cube,0,0,8

;
While Not KeyDown(1)

TurnEntity cube,1,1,1

UpdateWorld
RenderWorld



Text 100,100,"Press ESC to end."
apiInvalidateRect runtimewindow,0,True
; Flip
Wend
FreeEntity cube
FreeEntity light
FreeEntity camera
End

un rem out the flip and rem the InvalidateRect call to see the speed change, anyone now the implications of removing flip when using window mode.

kev


Perturbatio(Posted 2004) [#2]
I get a MAV if the invalidateRect is used.


fredborg(Posted 2004) [#3]
I haven't tried it yet, but wouldn't Flip False be just as fast? I guess I'll find out in a sec :)

edit: Flip false is just as fast :)

Try adding this:
If KeyHit(57) Then mode = (mode+1) Mod 3

Text 100,100,"Press ESC to end." 
If mode = 0
	Text 100,110,"InvalidateRect"
	apiInvalidateRect runtimewindow,0,True 
ElseIf mode = 1
	Text 100,110,"Flip False"
	Flip False
Else
	Text 100,110,"Flip"
	Flip
EndIf



Kev(Posted 2004) [#4]
yes, i did not think of flip false :) it does help with redrawing gadgets on the runtime window.


FBEpyon(Posted 2004) [#5]
All Flip False does is shuts off the vsync..

Not really what I call a preformance incress


Warren(Posted 2004) [#6]
Right ... so you're not waiting for the vertical sync, which means that if you're processing faster than the refresh rate of the monitor, you're getting more processor to use.

Sounds like a speed up to me.


FBEpyon(Posted 2004) [#7]
Yes but it is useless, why not program it to run vsynced


fredborg(Posted 2004) [#8]
Because it's slower?


Kev(Posted 2004) [#9]
fbepyon, it does have some use invalidateRect cause the window rect to redraw sending the WM_PAINT message to the window causing the gadgets to be redrawn this can not be done using flip.


FBEpyon(Posted 2004) [#10]
I might of miss understanded you, if you use flip false during a function to incress processing to some that would take alot of memory, then yes I would see its point, but I have talked to alot of people that use flip false in there main loop thru out the full game or app, and that to me is just plan sloppy programming :P and you would argee. but Kev im impressed with seeing how your GUI turns out because I have been looking for a nice one for a longtime other than BCF:P


Rottbott(Posted 2004) [#11]
It's no good going faster if you're going faster than the monitor can refresh anyway - the tearing just looks ugly.

Give me Vsync ON any day.


Jeroen(Posted 2004) [#12]
Hi Kev,

Will your Gui system include foldboxes, ala 3dsmax?