Hello,
My game receives this error when creating a new normal 8rgba canvas where I do not know why:
"Cannot create canvas: Texture format cannot be rendered to on this system."
I can reproduce this error when creating thousands of canvases until my system runs out of memory, but I'm very sure my game doesn't do this and it still crashes, sometimes early, sometimes later and not always. My game uses canvases to render chunks of the world and the amount of canvases can easily be limited, but as I said I do not think it reached a limit. On my cheap netbook, 2GB RAM, and maybe ~512 MB VRAM I can create 2200 512x512 8rgba canvases.
Are there any other reasons this error might appear?
Error when creating canvas
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
-
- Prole
- Posts: 3
- Joined: Fri Sep 15, 2017 2:14 am
Re: Error when creating canvas
I encountered the same issue and found your message on the forums. I was using code to create a canvas object out of a Text object so I could do interesting transforms on it:
I solved it by reviewing the textObject parameter I was passing that object. I forgot to properly index the object from the function call in another segment of code, so h and w were coming out to be zero. That's what threw the error. See the difference here:
vs.
THe first worked, the second gave the error. Try re-checking any parameters you send to newCanvas().
Code: Select all
function textToCanvasObject(textObject)
-- Maybe draw text onto a canvas first?
local h = textObject:getHeight()
local w = textObject:getWidth()
local textCanvas = love.graphics.newCanvas( w, h )
textCanvas:renderTo(
function()
love.graphics.clear()
love.graphics.draw(textObject, 0,0)
end
)
return canvasObject
end
Code: Select all
nameText = textToCanvasObject(love.graphics.newText(crisisFont, crisisList[i].name))
Code: Select all
nameText = textToCanvasObject(love.graphics.newText(crisisFont, name))
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests