Jump to content

how to show fps


tankhardrive
 Share

Recommended Posts

yep, that is correct!

 

functionApp:Start()
			self.window = Window:Create("dynamic material example",0,0,800,600,Window.Titlebar+Window.Center)
			self.context = Context:Create(self.window)
			self.world = World:Create()
			self.buffer = Buffer:GetCurrent()
			self.camera = Camera:Create()
			self.light = DirectionalLight:Create()
			self.light:SetRotation(45,45,45)
			self.box1 = Model:Box()
			self.mat1 = Material:Create()
			self.shader = Shader:Load("Shaders/model/diffuse.shader")
			self.mat1:SetShader(self.shader)
			self.shader:Release()
			self.box1:SetPosition(0,0,3)
			self.box1:SetMaterial(self.mat1)

			self.mybuffer = Buffer:Create(100,100,1,1)

			return true
end

function App:Loop()
			if self.window:Closed() or self.window:KeyHit(Key.Escape) then return false end

			self.box1:Turn(Time:GetSpeed()*0.5,Time:GetSpeed()*0.5,0)

			Time:Update()
			self.world:Update()
			Buffer:SetCurrent(self.buffer)
			self.world:Render()

			Buffer:SetCurrent(self.mybuffer)
			self.context:SetBlendMode(Blend.Alpha)
			self.context:SetColor(1,0,0,1)
			self.context:DrawRect(0,0,100,100)
			self.context:SetColor(1,.5,0,1)
			self.context:DrawText(string.format("FPS: %.2f",Time:UPS()),15,40)

			self.tex = self.mybuffer:GetColorTexture(0)
			self.mat1:SetTexture(self.tex,0)

			self.context:Sync(true)

			return true
end

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...