OSGL - EditableImage graphics library

Hello!

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 :eyes:)

1 Like

Ok i guess

So, normally in this api, you have to do

OSGL.SomeApi()
OSGL.SomeApi1()
...

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

shader_src = '
OSGL:Config1 = VALUE1
OSGL:Config2 = VALUE2

func main()
{
    var input = vec2(0, 10)

    SomeApi(input)
    SomeApi1()
   ...
}
'

local OSGL                                       = require(path.to.module)
local shader: OSGLshaderObject = OSGL:CompileShader(shader_src: string): OSGLshaderObject
OSGL:ParseShader(shader: OSGLshaderObject)
1 Like

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.

1 Like

Major Update, V1.5

It’s finally come!

  • Fonts
  • Performance improvements
  • Opacity modes
  • New github page

The Roblox model has been moved here! The original one will no longer be updated.
The new github can also be found, here.

Happy programming!

3 Likes

OSGL 1.6B Release!!! :tada::tada::tada:

Sorry for the drastic API changes… I promise this is the last time this happens! (seriously)

:sparkles: 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)

:shield: 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()

:zap: Drawing go brrrrrrrr

Somehow… it got EVEN FASTER. Enjoy the new drawing functions, guys :slight_smile:

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.

Enjoy!

7 Likes

OSGL 1.6.01b - Minor bug fix


– Fixed AddRenderers and RemoveRenderers


The RBXM, Github, and Wally have all been updated to reflect this small change!

OSGL 1.6.1 - Performance improvements


  • Major performance improvements to the circle and polygon drawing methods, from @msix29
  • Large performance improvement for drawing checked Textures (not rotated) thanks to @notclaramm
  • OSGL Will now use semver instead of 1.xb!
  • Fixed documentation for GetRelativeMousePosition

The RBXM, Github repo, and Wally have all been updated!

3 Likes

OSGL 1.6.15 - CanvasDraw SaveObjects, bug fixes & optimisations


  • 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! :eyes:

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.

2 Likes

Notice


The osgl-ts repository has been updated! You can find the latest release (1.6.15) on the github / on npm.

Window.fromAssetId isn’t working properly on version OSGL v1.6.15 because it isn’t providing renderers to Window.new function, please fix that. :face_with_spiral_eyes:

1 Like

Also Window.fromAssetId seems pretty much useless because it fills with blank color on creation, so you would need to make texture anyways?

1 Like

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

That should fix any issues!

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.

Oops… Will fix that right now. Thanks for letting me know!

This also includes the fromBuffer function, so I’ll fix that as well.

1 Like

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. :eyes:

What type issues exactly?

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?

OOOOOOO, EditableImage… Maybe I should play around with that some time, anyways this looks awesome.

1 Like

OSGL 1.6.2 - Bug Fixes


  • Fixed fromAssetId
  • Fixed fromBuffer
  • Fixed addRenderers
  • Fixed FloodFill
  • Fixed Tint
  • Fixed Buffer
  • Intellisense for OSGL now works in studio
  • Studio Image-Uploader over 350x faster, now supports images above 111x111

OSGL has been updated here, on the Roblox marketplace, the Github, and on wally. Enjoy :stuck_out_tongue:

3 Likes

If you do, I’d love to see what you create with it. Thanks too btw!

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):