You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating a canvas uses rgb4 by default instead of rgb8 as specified by the wiki. If you try to force it to create a Canvas using rgba8, it returns the following error:
The rgba8 canvas format is not supported by your graphics drivers.
Weirdly enough, srgba8, the gamma-correct version of rgba8, seems to be supported. Although this is not supported by all graphics cards so it's not a workaround that will work for everything.
This workaround seems to work for me for now. srgba8 seems to be supported by love.js on most devices. Even though I didn't see any noticeable changes, please note that srgba8 is supposed to change the colors rendered on screen.
EDIT: This will not work in LÖVE 12.
localold_newCanvas=love.graphics.newCanvasfunctionlove.graphics.newCanvas(width, height, settings)
settings=settingsor {}
ifnotsettings.formatthen-- Fallback chain for supported Canvas formatslocalsupportedCanvasFormats=love.graphics.getCanvasFormats()
localfallbackChain= {
-- It's possible to include other formats if necessary, as long as they have 4 components: -- https://love2d.org/wiki/PixelFormat-- I don't know much about the specifics of these formats, please adapt to what works best for you. -- Note that this does not take into account if `t.gammacorrect = true` is set in `love.conf`, please implement it yourself if needed."rgba8",
"srgba8",
"rgb10a2",
"rgb5a1",
"rgba4",
"normal"
}
localformat=fallbackChain[1]
locali=1whilei<=#fallbackChainandnotsupportedCanvasFormats[format] doi=i+1format=fallbackChain[i]
endifi==#fallbackChain+1thenerror("No valid canvas format is supported by the system")
endsettings.format=formatendreturnold_newCanvas(width, height, settings)
end
Creating a canvas uses rgb4 by default instead of
rgb8
as specified by the wiki. If you try to force it to create a Canvas usingrgba8
, it returns the following error:Weirdly enough,
srgba8
, the gamma-correct version ofrgba8
, seems to be supported. Although this is not supported by all graphics cards so it's not a workaround that will work for everything.This is mentioned by #55.
Workaround
This workaround seems to work for me for now.
srgba8
seems to be supported by love.js on most devices. Even though I didn't see any noticeable changes, please note thatsrgba8
is supposed to change the colors rendered on screen.EDIT: This will not work in LÖVE 12.
Examples
Source code:
Source code:
It's possible to see what formats are supported using this snippet of code in
love.draw
:The image I'm using:

The text was updated successfully, but these errors were encountered: