Cole Chapman Posted July 31, 2011 Share Posted July 31, 2011 The Problem: When the window is 800,600 using the Scene I want to load, I get about 13 Ave FPS (Not suprised, the Day and Night Settings are way up) What surprises me though is when I maximize the parent window to my full resolution (1920x1080), the FPS stays the same. When I scale it even lower than 800x600, the FPS still does not break 13. I always thought the more space a program/game had to render, the slower the performance (made sense logically) On another note, when I open the scene up in the Leadwerks Editor, I get a solid 30 FPS. Is this due to problems in my code, or does BlitzMax generally operate that slow (assuming Leadwerks Editor was written in C++ or something) Heres the code: SuperStrict Framework Leadwerks.Engine Import "Framework.BMX" Import MaxGUI.MaxGUI Import MaxGUI.Drivers Import BRL.EventQueue Include "lua-gluefunctions.bmx" RegisterAbstractPath("C:\Leadwerks Engine SDK") GCSetMode(2) Global FW:TFramework Local GEWindow:TGadget Local GEWindowX:Int 'Null (WINDOW_CENTER) Local GEWindowY:Int 'Null (WINDOW_CENTER) Local GEWindowW:Int = 800 Local GEWindowH:Int = 600 Local GEWindowStyle:Int = WINDOW_TITLEBAR|WINDOW_RESIZABLE|WINDOW_MENU|WINDOW_STATUS|WINDOW_CENTER Local Canvas1:TGadget Global Scene:TEntity Global Move:Float Global Strafe:Float Global CamRotation:TVec3 = Vec3(0) Global mx:Float Global my:Float Global MouseXInt:Int Global MouseYInt:Int GEWindow:TGadget = CreateWindow("GE", GEWindowX, GEWindowY, GEWindowW, GEWindowH, Null, GEWindowStyle) Canvas1:TGadget = CreateCanvas(0, 0, ClientWidth(GEWindow), ClientHeight(GEWindow), GEWindow) SetGadgetLayout(Canvas1, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED) SetGraphics(CanvasGraphics(Canvas1)) ActivateGadget(Canvas1) EnablePolledInput() FW:TFramework = CreateFramework() If Not FW RuntimeError "Failed to Initialize Engine" SetScriptObject("fw", fw) Scene:TEntity = LoadScene("abstract::DayNightCycle.sbx") PositionEntity(fw.Main.camera, StringToVec3(GetEntityKey(scene, "cameraposition"))) Repeat While PeekEvent() WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_WINDOWSIZE SetGraphics CanvasGraphics(Canvas1) EndSelect Wend CameraUpdate() If KeyDown(KEY_ESCAPE) Then End FW.Update() FW.Render() SetBlend(1) DrawText(MouseX(), 0, 10) SetBlend(0) Flip(0) Forever GCCollect() End Function CameraUpdate() If KeyDown(KEY_SPACE) mx = MouseX() - GraphicsWidth()/2 my = MouseY() - GraphicsHeight()/2 MoveMouse(GraphicsWidth()/2, GraphicsHeight()/2) CamRotation.X = CamRotation.X + my CamRotation.Y = CamRotation.Y - mx RotateEntity(FW.Main.Camera, CamRotation) move = KeyDown(KEY_W) - KeyDown(KEY_S) strafe = KeyDown(KEY_D) - KeyDown(KEY_A) MoveEntity(fw.Main.camera, Vec3(strafe / 10.0, 0, move / 10.0)) EndIf EndFunction Function StringToVec3:TVec3(text:String, scale:Float = 1.0) Local t:TVec3 = Vec3(1) Local sarr:String[] sarr = text.split(",") If sarr If sarr.length > 0 t.x = Float(sarr[0]) * scale If sarr.length > 1 t.y = Float(sarr[1]) * scale If sarr.length > 2 t.z = Float(sarr[2]) * scale EndIf Return t EndFunction 'These functions allow you to pass framework to the lua state' Function SetScriptObject(name:String, o:Object) Local size:Int=GetStackSize() lua_pushbmaxobject(luastate.L,o) lua_setglobal(luastate.L,name) SetStackSize(size) EndFunction Function GetStackSize:Int() Return lua_gettop(luastate.L) EndFunction Function SetStackSize(size:Int) Local currentsize:Int=GetStackSize() If size<currentsize lua_pop(luastate.L, currentsize - size) EndIf EndFunction Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 31, 2011 Share Posted July 31, 2011 are you creating the program executable in release mode? the fps you are describing sounds like debug... also the editor is made with bmax/maxgui. Quote 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 More sharing options...
Cole Chapman Posted July 31, 2011 Author Share Posted July 31, 2011 Oh wow, I forgot all about build options. I thought that the exe that BMax built just said .debug and it was the final executable Thank you for helping, the FPS cleared right up when I unchecked Debug. and I had no idea the editor was made in Bmax, thats pretty sweet Thanks again! Quote Link to comment Share on other sites More sharing options...
klepto2 Posted July 31, 2011 Share Posted July 31, 2011 [Edit] Forget it. My Fault. Long time not programmed with Maxgui. Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Cole Chapman Posted August 1, 2011 Author Share Posted August 1, 2011 Okay I have another question. How come the FPS drops down so much when looking straight down at a terrain compared to when your looking at an angle? (Its like this in the Editor as well) Quote Link to comment Share on other sites More sharing options...
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.