about drawing images
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
about drawing images
I test LOVE game on two computers. One of them is netbook with mobile graphic card , second is usual PC. When I run game on netbook all images who have not standard size (26x26 25x25 etc) Love render as white cubes . On PC all renders fine. Have any ideas how to fix that? Is the problem of compatibility?
Re: about drawing images
thx! Simple and helpful solution posted by Robin
Code: Select all
local nwimage = love.graphics.newImage
function love.graphics.newImage(source)
if type(source) == "string" then
source = love.image.newImageData(source)
end
local w, h = source:getWidth(), source:getHeight()
local wp = math.pow(2, math.ceil(math.log(w)/math.log(2)))
local hp = math.pow(2, math.ceil(math.log(h)/math.log(2)))
if wp ~= w or hp ~= h then
local padded = love.image.newImageData(wp, hp)
padded:paste(source, 0, 0)
return nwimage(padded)
end
return nwimage(source)
end
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: about drawing images
Not originally my code, but glad I could "help".
Also, some time in the future (probably sooner rather than later), LÖVE 0.8.0 will come out, and it has auto-padding for computers that need it, which means you don't have to worry about all that any more.
Also, some time in the future (probably sooner rather than later), LÖVE 0.8.0 will come out, and it has auto-padding for computers that need it, which means you don't have to worry about all that any more.
Help us help you: attach a .love.
Re: about drawing images
Hmm I've never encountered this PO2 Syndrome, possibly because I always use numbers that are powers of two instinctively, seems to make more sense to me... that a bad thing?
Also, does this PO2S affect only LOVE/Lua or is it applicable to other things such as C+ e.c.t.? It's interesting to say the least, I can't understand why a graphics card can't display something just because it's not a power of 2 :L if it affects other things then hardware manufacturers should be ashamed... or are we talking win98 cards/drivers?
Also, does this PO2S affect only LOVE/Lua or is it applicable to other things such as C+ e.c.t.? It's interesting to say the least, I can't understand why a graphics card can't display something just because it's not a power of 2 :L if it affects other things then hardware manufacturers should be ashamed... or are we talking win98 cards/drivers?
Re: about drawing images
PO2 syndrome is caused by graphics drivers. Nvidia cards usually don't have the problem but ATI cards do from what I hear.
Re: about drawing images
Sometimes these errors can be fixed by updating the graphics drivers. At least with Intel cards that is.
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: about drawing images
How do I update them on Ubuntu?vrld wrote:Sometimes these errors can be fixed by updating the graphics drivers. At least with Intel cards that is.
Re: about drawing images
In the dash, type and click on Hardware DriversTechnoCat wrote:How do I update them on Ubuntu?vrld wrote:Sometimes these errors can be fixed by updating the graphics drivers. At least with Intel cards that is.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: about drawing images
There's no hardware drivers avaliable for my machine >.< Advent 4211 (rebranded MSI wind) I was looking for ways to just download the drivers from a website and use them with ubuntu, but meh... it works, that's all that matters.
From what PCWorld told me, my computer doesn't have a proper graphics card, just the default motherboard one for the monitor, and uses Intel express media accelerator... and they were confused that this netbook ran doom3
From what PCWorld told me, my computer doesn't have a proper graphics card, just the default motherboard one for the monitor, and uses Intel express media accelerator... and they were confused that this netbook ran doom3
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest