gfx driver sprite test

BlitzPlus Forums/BlitzPlus Programming/gfx driver sprite test

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

I've tidied up your code a bit, and included a FPS counter. I must say though that I got quite different results to what you said.

DDRAW was the fastest on all counts, except for in 320x240 when NATIVE beat it (400FPS to 300FPS). OPENGL did quite poorly, staying at 62FPS all the time. But here's what's interesting, even when I changed the Image memory mode to 4 (NON-VRAM) the OPENGL framerate was still about 62, while all the others dropped by at least half. (But still about 80)

Anyway, see for yourself. Just try the constants at the top and let me know what framerates you get..

Const GFXMODE = 3	;graphics mode  1=NATIVE 2=OPENGL 3=DDRAW
Const IMGMODE = 2	;image mode     1=STABLE 2=FAST   4=NON-VRAM
Const w=640			;screen width 
Const h=480			;screen hight 
Const b=500			;number of sprites

SetGfxDriver GFXMODE

Graphics w,h,16,2
Dim x(50000) 
Dim y(150000) 
Dim statex(50000) 
Dim statey(50000) 

;create dot sprite 
sprite=CreateImage(16,16,1,IMGMODE) 
SetBuffer ImageBuffer(sprite) 
	Color 255,255,255 
	Rect 0,0,16,16,0
SetBuffer BackBuffer() 


;set up sprites 
For n=0 To b 
	statey(n)=Rand(0,1)*2-1 
	statex(n)=Rand(0,1)*2-1 
	x(n)=Rnd(w)
	y(n)=Rnd(h) 
Next 

;main loop condition
time1=MilliSecs()
While Not KeyHit(1) 
	Cls 
	
	For n=0 To b
		DrawImage sprite,x(n),y(n) ; Draw the image!
		x(n)=x(n)+1*statex(n) 
		y(n)=y(n)+1*statey(n) 
		If x(n)>w Then statex(n)=-1 
		If x(n)<0 Then statex(n)=1 
		If y(n)>h Then statey(n)=-1 
		If y(n)<0 Then statey(n)=1 
	Next

	frames=frames+1
	If MilliSecs()-time1>500 Then time1=time1+500 FPS=frames*2 frames=0
	Text 0,20,FPS ;find out how quick it was. 
	
	Flip 0
Wend