Yue Posted April 9, 2025 Posted April 9, 2025 w = world:Get() Print(tostring( w.renderstats.vram)) GTX 1070 8 vram. Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
Dreikblack Posted April 9, 2025 Posted April 9, 2025 You need to do before w:RecordStats() Quote Check out Slipgate Tactics - turn based tactics Quake fan game, which is made with Ultra Engine/Leadwerks 5: https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/
Yue Posted April 9, 2025 Author Posted April 9, 2025 1 hour ago, Dreikblack said: You need to do before w:RecordStats() return nil. function World:New() local this = setmetatable({}, World) -- Crear el mundo local world = CreateWorld() world:RecordStats(true) local mapName = "Maps/start.map" this.scene = nil Print("⚠️[World] Mundo creado exitosamente.") -- Métodos de instancia function this:Update() world:Update() end function this:Render(framebuffer) world:Render(framebuffer) Print(tonumber(world.renderstats.vram)) end Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
Yue Posted April 9, 2025 Author Posted April 9, 2025 Code Sample documentatation. -- Get the displays local displays = GetDisplays() -- Create a window local window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[1]) -- Create a framebuffer local framebuffer = CreateFramebuffer(window) -- Create a world local world = CreateWorld() -- Create a camera local camera = CreateCamera(world) camera:SetClearColor(0.125) camera:Move(0, 0, -4) -- Create light local light = CreateBoxLight(world) light:SetRange(-20, 20) light:SetArea(20, 20) light:SetRotation(45, 35, 0) -- Create model local box = CreateBox(world) -- Enable stats recording world:RecordStats(true) -- Setup 2D display local cam2d = CreateCamera(world, PROJECTION_ORTHOGRAPHIC) cam2d:SetRenderLayers(128) cam2d:SetClearMode(CLEAR_DEPTH) cam2d:SetPosition(framebuffer.size.x * 0.5, framebuffer.size.y * 0.5, 0) local font = LoadFont("Fonts/arial.ttf") local sprite = CreateSprite(world, font, "", 18) sprite:SetRenderLayers(128) sprite:SetPosition(2, framebuffer.size.y - font:GetHeight(18) - 2, 0) -- Main loop while window:Closed() == false and window:KeyDown(KEY_ESCAPE) == false do box:Turn(0,1,0) -- Display the framerate sprite:SetText("FPS: " .. tostring(world.renderstats.vram)) world:Update() world:Render(framebuffer) end Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
Dreikblack Posted April 9, 2025 Posted April 9, 2025 True, checked in C++, returns 0 there 1 Quote Check out Slipgate Tactics - turn based tactics Quake fan game, which is made with Ultra Engine/Leadwerks 5: https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/
Josh Posted April 9, 2025 Posted April 9, 2025 This is currently not implemented, because I have not found a reliable cross-hardware way to do this. 1 Quote Let's build cool stuff and have fun.
Josh Posted April 9, 2025 Posted April 9, 2025 Need to use this probably: https://registry.khronos.org/OpenGL/extensions/ATI/ATI_meminfo.txt 1 Quote Let's build cool stuff and have fun.
Yue Posted April 9, 2025 Author Posted April 9, 2025 -- Uso de memoria de Lua (KB) local memLua = math.floor(collectgarbage("count")) .. " KB" -- Acumulamos el tiempo de CPU para sacar un promedio self.frameCounter = self.frameCounter + 1 self.timeAccumulator = self.timeAccumulator + (stats.rendertime or 0) if self.frameCounter >= 30 then local avgCPU = self.timeAccumulator / self.frameCounter local cpuTime = string.format("%.2f ms", avgCPU) self.labels.mem:SetText("Lua: " .. memLua .. " | CPU: " .. cpuTime) -- Reiniciamos los contadores self.timeAccumulator = 0 self.frameCounter = 0 end Quote Murphy's Law: We don't fix bugs, we document them as features. – Murphy Games
Solution Josh Posted April 10, 2025 Solution Posted April 10, 2025 I am adding vram to the structure definition for Lua. The value will indicate the AVAILABLE memory, not the total, and will work with Nvidia and AMD cards. 1 Quote Let's build cool stuff and have fun.
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.