Page 1 of 1

Newbie Image Question

Posted: Mon Jan 11, 2010 4:27 am
by keithf25
ok, i have just started mucking about with LOVE (great so far, btw). I am running into a very basic problem. I am trying to draw some simple images to the screen, and i just get a white box, albeit in the right position and size. I am using lua code straight from the hamster ball demo. I even tried a .png from another demo, thinking perhaps it was my file. That gets me a white box as well. Could this be something external from LOVE itself? Hardware or drivers or something, possibly? Maybe my directX is out of date? Any pointers would be greatly appreciated. Here's my basic hacky code:

Code: Select all

function love.load()
   hamster = love.graphics.newImage("images/tulip.png")
   card_one = love.graphics.newImage("images/card_1.png")
   --x = 50
   --y = 50
   --speed = 100
end


function love.update(dt)
	mouse_x = love.mouse.getX()
	mouse_y = love.mouse.getY()
end



function love.draw()

  --love.graphics.print("Hello World", 400, 300)
  --love.graphics.circle("fill", 300, 300, 50)
  love.graphics.print( "Mouse X: ".. mouse_x .. " Mouse Y: " .. mouse_y, 10, 20 )
  --love.graphics.draw(hamster, 50, 50)
  love.graphics.draw(card_one, 300, 50)
end

Re: Newbie Image Question

Posted: Mon Jan 11, 2010 4:44 am
by Fourex
I can't figure out what you're doing wrong, unless you're forgetting to put the images in a file called "images". But, I'm not exactly an expert...

Re: Newbie Image Question

Posted: Mon Jan 11, 2010 6:58 am
by bartbes
With older videocards/drivers you get those white boxes when your images are not correctly sized, their width and height need to be a power of two (but width doesn't need to be the same as height), so, for example 256x128.

Re: Newbie Image Question

Posted: Mon Jan 11, 2010 1:58 pm
by TechnoCat

Re: Newbie Image Question

Posted: Tue Jan 12, 2010 2:53 am
by keithf25
Yup, it was the power of 2 issue. Thanks everybody for your help!