Yue Posted April 9 Posted April 9 w = world:Get() Print(tostring( w.renderstats.vram)) GTX 1070 8 vram. Quote
Yue Posted April 9 Author Posted April 9 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
Yue Posted April 9 Author Posted April 9 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
Josh Posted April 9 Posted April 9 This is currently not implemented, because I have not found a reliable cross-hardware way to do this. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Josh Posted April 9 Posted April 9 Need to use this probably: https://registry.khronos.org/OpenGL/extensions/ATI/ATI_meminfo.txt 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Yue Posted April 9 Author Posted April 9 -- 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
Solution Josh Posted April 10 Solution Posted April 10 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 My job is to make tools you love, with the features you want, and performance you can't live without.
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.