Alienhead Posted November 12, 2023 Share Posted November 12, 2023 I need to run a 1920x1080 window but stretched to the users desktop resolution. Is DPI implemented yet? How do I go about this? Thanks. Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Josh Posted November 12, 2023 Share Posted November 12, 2023 The camera drawing system is flexible enough you can do this without any special feature to support it. Render to a 1920x1080 texture buffer. Apply the texture to a material on a sprite that is placed in front of a camera with orthogonal projection. Take victory lap because you just won. This is exactly the steps any built-in window scaling feature would do, but you have exact control over it. If you wanted to get even fancier, it would be completely possible to render any GUI or HUD after this, with no downsampling, so those elements would be crisp and clear on top of the lower-res 3D render. The Interface class has a SetScale command which can be used to scale up the size of a GUI to match the window display scale setting. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Alienhead Posted November 13, 2023 Author Share Posted November 13, 2023 Awesome! ty Quote I'm only happy when I'm coding, I'm only coding when I'm happy. Link to comment Share on other sites More sharing options...
Josh Posted November 28, 2023 Share Posted November 28, 2023 Here's an example: --Load FreeImage plugin (optional) local fiplugin = LoadPlugin("Plugins/FITextureLoader") --Get the displays local displays = GetDisplays() --Create a window local window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[1].scale, 720 * displays[1].scale, displays[1], WINDOW_CENTER | WINDOW_TITLEBAR) --Create a framebuffer local framebuffer = CreateFramebuffer(window) --Create a world local world = CreateWorld() local cam = CreateCamera(world) cam:AddComponent(CameraControls) cam:SetPosition(0,1,-1) --cam:SetFov(70) local sz = Vec2(framebuffer.size.x * 0.25, framebuffer.size.y * 0.25) local texbuffer = CreateTextureBuffer(sz.x, sz.y) cam:SetRenderTarget(texbuffer) local cam2 = CreateCamera(world, PROJECTION_ORTHOGRAPHIC) cam2:SetRenderLayers(2) local sprite = CreateSprite(world, framebuffer.size.x, framebuffer.size.y) local mtl = CreateMaterial() local fam = LoadShaderFamily("Shaders/Unlit.fam") local tex = texbuffer:GetColorAttachment(1) mtl:SetTexture(tex) mtl:SetShaderFamily(fam) sprite:SetMaterial(mtl) sprite:SetRenderLayers(2) cam2:SetPosition(framebuffer.size.x * 0.5, framebuffer.size.y * 0.5, 0) --Load a map local mapname = "Maps/start.ultra" local cl = CommandLine() if type(cl["map"]) == "string" then mapname = cl["map"] end local scene = LoadMap(world, mapname) while window:KeyDown(KEY_ESCAPE) == false and window:Closed() == false do --Update the world world:Update() --Render the world to the framebuffer world:Render(framebuffer) end Quote My job is to make tools you love, with the features you want, and performance you can't live without. 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.