Could you elaborate on what you mean any further? I’m not quite sure I understand (sorry!).
If EditableImages use the GPU, it would be faster but we’ll probably never get to Vulkan performance. You can make semi-realtime pathtracers (30 - 60FPS with realtime reflections and stuff, an example of this coming soon )
The like performance issue with this is function call overhead, slightly losing performance. So, with shaders, you can convert multiple calls into a single function call, increasing performance.
instead of the above, you can
Sadly in Luau there’s no way to really remove the API calls overhead. This would be extremely inefficient as either way, it’s really just still calling a function. Basically, it’s impossible.
Sorry for the drastic API changes… I promise this is the last time this happens! (seriously)
Brand New Docs Site
Say hello to a custom-built documentation hub designed specifically for OSGL! The new site features:
Complete API reference for all 1.6B changes
Interactive examples you can tweak live
Error handling guides (because we all need them)
New Result Type System
Rustaceans will feel right at home C: Many functions now have:
Checked variants returning Result<T, E>
Unchecked variants for performance-critical code
Error handling for virtually everything!
Example:
local window = Window.new(image, WIDTH, HEIGHT)
if not window.isOk then
warn(window:UnwrapErr())
-- Handle error
end
local unwrappedWindow = window:Unwrap()
Drawing go brrrrrrrr
Somehow… it got EVEN FASTER. Enjoy the new drawing functions, guys
Go break some code (responsibly)!
The full (and very serious) changelog for the nerds
Mesh, Texture, and Decal support
Error handling
API Changes
Optimised functions
New & Improved docs site
OSGL Image Uploader plugin for studio, which you can get here.
Large performance improvement for drawing unrotated unchecked Textures using @notclaramm’s method
Prevented FloodFill from always erroring
Included a stylua.toml for those using Stylua while developing in the Github Repo
And while we’re at it, in parallel with CanvasDraw’s next patch, we’re also introducing a Texture.fromCanvasDrawSaveObject function. Now, you can load a CanvasDraw SaveObject of any version as an OSGL Texture:
local saveObject = script.saveObject
local texture = Texture.fromCanvasDrawSaveObject(saveObject):Unwrap()
Big thank you to @Ethanthegrand14 for the concept, (and for the function code lol)!
CanvasDraw will also be updated with a similar function, allowing for cross-compatibility between both modules. Expect more of this soon!
The RBXM, Github repo, Wally, and Docs have all been updated! Enjoy!
Note:
The osgl-ts repository will be updated to the latest version soon! Sorry for the delay.
I’ve fixed this in 1.6.2, will push later to the experimental branch. Ty for this report!
Oh my gof, thanks so much for picking that up. Will also fix this in the next push!
Until then, you can replace Window.new with:
function Window.new(editableImage: EditableImage, renderers: { types.Drawable }): types.Window
local content = Content.fromObject(editableImage)
for _, renderObject in ipairs(renderers) do
local sourceProperty = Window.getRenderingProperty(renderObject)
if sourceProperty == "" then
continue
end
renderObject[sourceProperty] = content
end
local size = editableImage.Size
local width, height = size.X, size.Y
local t = windowBase.new()
t.surfaces = renderers
t.editableImage = editableImage
t.buffer = buffer.create(width * height * 4)
t.width = width
t.height = height
t.size = size
t.targetFPS = 60
t.lastRenderTime = os.clock()
return t
end
… and fromAssetId with:
function Window.fromAssetId(assetId: string): Result<types.Window, oEnum.WindowError>
local texture = Content.fromAssetId(assetId)
local success, editableImage = pcall(function()
return AssetService:CreateEditableImageAsync(texture)
end)
if not success then
return result.new(false, oEnum.DrawableObjectError.NotEnoughMemory)
end
return result.new(true, Window.new(editableImage, {}))
end
Yeah I pretty much did that by myself by there’s one other issue that need to be addressed: You should probably write image to buffer because :Render sets it to “empty” buffer.
Thanks!
Also reviewed some other modules that you have and optimization with native code generation is good but you could probably fix some type issues because those are important while using native gen.
If you’re talking about the weird DrawableImage one, that’s fixed in 1.6.2. If not, mind moving this conversation to our Discord server so we can talk there?
Are you able to translate and scale the canvas like what you can do with SkiaSharp (for C#)?
Here is what I mean (using my own software as an example):