Images dont Load
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- 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?
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.
-
- 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
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.
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.
-
- 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?
Re: Images dont Load
Yes.
-
- 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:
Then you need to make no further changes to make it work.
in the same folder as your main.lua, and start your main.lua with:
Code: Select all
require 'padding'
Help us help you: attach a .love.
-
- 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: Bing [Bot], Google [Bot] and 8 guests