Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

context:DrawImage in GUI


Recommended Posts

You would want to use gui:DrawImage(). This will use either 3D rendering or the system 2D drawing commands, depending on how the GUI is being used.

The GUI system does not handle "textures" it handles "images", which can be a texture behind-the-scenes but it is set up to work direct drawing onto windows.

This is being done so that the future editor can use the exact same GUI.

Link to post

The panel script actually already supports images. However, you need to call widget:Redraw() after setting the image to trigger a re-render. I am adding an internal call to make this automatic.

local window = Window:Create()
local context = Context:Create(window)
local gui = GUI:Create(context)
local base = gui:GetBase()


widget = Widget:Panel(x,y,400,120,base)
local image = gui:LoadImage("Materials/Common/splash.tex")

while true do
        if window:Closed() then return end
        if window:KeyHit(Key.Escape) then return end

As for custom shaders, the GUI system is not as flexible as the general 2D drawing system, and it has no concept of "shaders" right now because it needs to render the same things with the OS 2D drawing commands.

  • Like 1
Link to post

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Facebook Twitter Youtube Github Steam
  • Create New...