## Images dont Load

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Umbrageous
Prole
Posts: 8
Joined: Sat Apr 10, 2010 5:45 pm

### Images dont Load

Images dont Load, when I Draw them, all i get is a white block in the dimensions of the original object, am i doing something wrong or is it a hardware failure?
never
Prole
Posts: 10
Joined: Sun Apr 11, 2010 4:20 am

### Re: Images dont Load

You should post your code I'm new to love but Ive spent a lot of time with the draw function.
Umbrageous
Prole
Posts: 8
Joined: Sat Apr 10, 2010 5:45 pm

### Re: Images dont Load

I just used the Hamster Tutorial, but replaced it with the love logo

Code: Select all

function love.load()
lovelogo = love.graphics.newImage("love-logo.JPG")
x = 40
y = 50
speed = 100
end
function love.update(dt)
if love.keyboard.isDown("right") then
x = x + (speed * dt)
elseif love.keyboard.isDown("left") then
x = x - (speed * dt)
end

if love.keyboard.isDown("down") then
y = y + (speed * dt)
elseif love.keyboard.isDown("up") then
y = y - (speed * dt)
end
end

function love.draw()
love.graphics.draw(lovelogo, x, y)
end
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

### Re: Images dont Load

It's a hardware thing. Some graphics cards don't support non-power-of-2 images - that is, images with dimensions that are not powers of 2. The LÖVE logo falls under this category.

The easiest way to deal with this is just to use images with power of 2 dimensions. However, for images that aren't the right size, you can use the padding function found on the wiki to avoid the issue.
Umbrageous
Prole
Posts: 8
Joined: Sat Apr 10, 2010 5:45 pm

### Re: Images dont Load

Hmm, Seems almost unnesecary lol. So would it just be best to use all images that are a power of two?
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

### Re: Images dont Load

Yes.
Umbrageous
Prole
Posts: 8
Joined: Sat Apr 10, 2010 5:45 pm

### Re: Images dont Load

Okay, but just for the sake of knowing can you take the bit of code i used, and show me how to correctly implement the padding function?
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: Images dont Load

You can also put this file:
in the same folder as your main.lua, and start your main.lua with:

Code: Select all

require 'padding'
Then you need to make no further changes to make it work.
Help us help you: attach a .love.
Umbrageous
Prole
Posts: 8
Joined: Sat Apr 10, 2010 5:45 pm

### Re: Images dont Load

Wow! Thanks for the all the help, everything works fine now.

### Who is online

Users browsing this forum: No registered users and 27 guests