tankhardrive Posted August 9, 2014 Posted August 9, 2014 Hey this is a dumb question but how do you go about showing the fps? Is it just the ups from time? Just got this engine and that info would be useful going forward. Ups makes sense it just seems to be very inconsistent. Thanks! Quote
macklebee Posted August 9, 2014 Posted August 9, 2014 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 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel
tankhardrive Posted August 9, 2014 Author Posted August 9, 2014 Awesome thanks thought so was just seeing huge swings in a base app. Quote
tjheldna Posted August 9, 2014 Posted August 9, 2014 Dont forget you can view the fps and more via it this way too... c++ Context *context = Context::GetCurrent(); context->DrawStats(10, 10, false); lua (not tested) self.context:DrawStats(10, 10, false) 1 Quote
Recommended Posts
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.