Slow Down unknown

Blitz3D Forums/Blitz3D Programming/Slow Down unknown

Const FPS=65
Global framePeriod=1000/FPS
Global frameTime=MilliSecs()-framePeriod
While Not KeyHit(1)
		Repeat
			frameElapsed=MilliSecs()-frameTime
		Until frameElapsed
		frameTicks=frameElapsed/framePeriod
		frameTween#=Float(frameElapsed Mod frameperiod/Float(frameperiod))
		For frameLimit=1 To frameTicks
			If frameLimit=frameTicks Then CaptureWorld
			frameTime=frameTime+framePeriod
			UpdateWorld()
			If curmode%=0
				UpdateSpaceMenu()
			Else
				UpdateGame()
			EndIf
			
		Next
	RenderWorld frameTween	
	If curmode%=0
		UpdateSpaceMenu_HUD()
	Else
		UpdateGame_HUD()
	EndIf
	Flip
Wend
End

Function UpdateSpaceMenu()
	mx=MouseX()
	my=MouseY()
	TurnEntity planet1,0,.05,0
	pick%=CameraPick(cam,MouseX(),MouseY())  ;<--- This is the main source of it!
	;If pick=planet1
	;	EntityColor planet1,255,0,0
	;	EntityAlpha planet1,.8
	;Else If pick=0
	;	If oldpick=planet1
	;		EntityColor planet1,127,127,127
	;		EntityAlpha planet1,1
	;	EndIf
	;EndIf
	oldpick=pick
End Function

Function UpdateSpaceMenu_HUD()
	DrawImage(cur2,mx,my)
End Function


Why is the fps dropping so low? I've tried in both debug and not. The scene is only 2900 tris. Its just a planet in space . Any ideas by looking at it?

|Notice the comment on the camerapick line in UpdateSpaceMenu!|