Code archives/3D Graphics - Mesh/Starfield Stress Test (Blitz3D)

This code has been declared by its author to be Public Domain code.

Download source code

Starfield Stress Test (Blitz3D) by Captain Wicker (crazy hillbilly)2012
Test the "speed" of blitz3d.
Graphics3D 800,600,32,2
SeedRnd MilliSecs()
SetBuffer BackBuffer()

Local light=CreateLight()

Global camera=CreateCamera()


Dim spheres(1000)


Repeat

	For t=1 To 1000
		spheres(t)=CreateSphere(1.5)
		ScaleEntity spheres(t),.01,.01,.01
		PositionEntity spheres(t),Rand(-t,t),Rand(-t,t),Rand(-t,t)
	Next


	MoveCamera(camera)

	UpdateWorld()
	RenderWorld()
	ShowFPS(10,10)
	Flip(True)
Until KeyHit(1)


Function MoveCamera(camera_name%)
	If KeyDown(203)
		MoveEntity(camera_name%,-1,0,0)
	ElseIf KeyDown(205)
		MoveEntity(camera_name%,1,0,0)
	EndIf
	If KeyDown(200)
		MoveEntity(camera_name%,0,0,1)
	ElseIf KeyDown(208)
		MoveEntity(camera_name%,0,0,-1)
	EndIf
End Function

Function ShowFPS(x#,y#)
	timenow=MilliSecs()
	If timenow>telltime Then
		telltime=timenow+1000
		frames=0
	Else
		frames=frames+1
	EndIf
		Text x#,y#,frames
End Function

Comments

Captain Wicker (crazy hillbilly)2012
Oops. I didn't do something right in the ShowFPS function.
Here is updated code.
Graphics3D 800,600,32,2
SeedRnd MilliSecs()
SetBuffer BackBuffer()

Local light=CreateLight()

Global camera=CreateCamera()


Dim spheres(1000)


Repeat

	For t=1 To 1000
		spheres(t)=CreateSphere(1.5)
		ScaleEntity spheres(t),.01,.01,.01
		PositionEntity spheres(t),Rand(-t,t),Rand(-t,t),Rand(-t,t)
	Next


	MoveCamera(camera)

	UpdateWorld()
	RenderWorld()
	GetFPS(10,10)
	Flip(True)
Until KeyHit(1)


Function MoveCamera(camera_name%)
	If KeyDown(203)
		MoveEntity(camera_name%,-1,0,0)
	ElseIf KeyDown(205)
		MoveEntity(camera_name%,1,0,0)
	EndIf
	If KeyDown(200)
		MoveEntity(camera_name%,0,0,1)
	ElseIf KeyDown(208)
		MoveEntity(camera_name%,0,0,-1)
	EndIf
End Function

;Function ShowFPS(x#,y#)
;	timenow=MilliSecs()
;	If timenow>telltime Then
;		telltime=timenow+1000
;		frames=0
;	Else
;		frames=frames+1
;	EndIf
;		Text x#,y#,frames
;End Function

Function GetFPS(x#,y#)
	fps=fps+1
	If fps_t<MilliSecs()
	    fp$=" "+Str$(fps)
	    fps_t=1000+MilliSecs()
	    fps=0
	EndIf
	fps2=fps2+1
	If fps_t2<MilliSecs()
	    fps3#=fps2
	    fps_t2=30+MilliSecs()
	    fps2=0
	EndIf
	Text x#,y#,"FPS: "+fp$
End Function

You will see that the speed of Blitz3d greatly decreases as the ammount of stars increase.


andy_mc2012
Nice benchmark. But you'll find some popel here will talka bout the number of surfaces affecting performance more than polygon count and all that good stuff. I've not done much in 3D so can't comment much on it.


Naughty Alien2012

You will see that the speed of Blitz3d greatly decreases as the ammount of stars increase.



..what stars?? This is nothing but example of how to throw bunch of random triangles until GPU dies, there is no benchmarking data of any kind present here, in order to determine any kind of stress test over various GPU's..


Code Archives Forum