Page 1 of 10

I have a question.

Posted: Sat Oct 23, 2010 12:22 am
by com_1
Sorry for my english.

2 days ago, downloaded and installed - "LOVE".
With graphics ok. but with images is problem. (loaded only white square)
The picture is the same place where "main.lua"
WHAT IS WRONG ?

function love.load()
image = love.graphics.newImage("test.bmp")
end

function love.draw()
love.graphics.draw(image)
end

Thanks in advance.

Re: I have a question.

Posted: Sat Oct 23, 2010 12:29 am
by Tesselode
Try making the width and height of the image a multiple of 2.

Re: I have a question.

Posted: Sat Oct 23, 2010 12:32 am
by Thursdaybloom
Try this

Code: Select all

love.graphics.draw(image, 50, 100)
You need to state where on the X and Y axis the image is going to be placed. In the above example it will be at 50 pixels in along the X axis and 100 pixels down the Y axis.

Code: Select all

love.graphics.draw(image, 0, 0)
This will draw the image at the top left-hand corner of the screen

If that doesn't work can you let us know what the dimensions of the image are? In most cases images need to be of dimensions that conform to the power of 2. Examples of this are 32x32, 64x64, 128x128, 256x256 and so on. You can probably guess the rest of them.

I suggest making a 256x256 test.bmp and trying that

Re: I have a question.

Posted: Sat Oct 23, 2010 11:42 am
by com_1
The problem is here.
Images that have dimensions that are not a 2^n will display incorrectly as a white rectangle on some graphics chipsets.
This function pads images so they will display correctly.
Only
Examples of this are 8x8, 16x16, 32x32, 64x64, 128x128, 256x256 and so on.
works without problem.


Thanks for comments.

Re: I have a question.

Posted: Sat Oct 23, 2010 12:37 pm
by zac352
Tesselode wrote:Try making the width and height of the image a multiple power of 2.
Fix.
Thursdaybloom wrote:Examples of this are 32x32, 64x64, 128x128, 256x256 and so on. You can probably guess the rest of them.
To convert between binary and decimal, you must know your powers of two:
1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16 384
32 768
65 536
And so on.
Edit: Sorry if that was kind of.. uh.. high horse-ish? But seriously, I memorise numbers easily. I know 39 digits of pi. May have forgotten some, though. I'm rusteh.

Re: I have a question.

Posted: Sat Oct 23, 2010 12:55 pm
by Thursdaybloom
Thursdaybloom wrote:You can probably guess the rest of them.
You'll find the pattern used is that each entry is double that of the previous. No memorisation required, just keep doubling. I didn't keep listing examples because I don't assume com_1 is stupid and I'm quite sure he can figure out what I meant.

Re: I have a question.

Posted: Sat Oct 23, 2010 4:11 pm
by TechnoCat
Thursdaybloom wrote:Examples of this are 32x32, 64x64, 128x128, 256x256 and so on. You can probably guess the rest of them.
I believe dimensions such as 64x128, 256x16, etc. work too. The requirement is 2^n length sides.

Re: I have a question.

Posted: Sat Oct 23, 2010 10:30 pm
by Thursdaybloom
TechnoCat wrote:I believe dimensions such as 64x128, 256x16, etc. work too. The requirement is 2^n length sides.
It's been a while but I think that failed for some people on my Top-Down City project (ie. only square dimensions wored). I've never suffered from this problem though, so I'm not the most experienced in dealing with it. You're more than likely correct though :3

Re: I have a question.

Posted: Sat Oct 23, 2010 10:33 pm
by Robin
Thursdaybloom wrote:It's been a while but I think that failed for some people on my Top-Down City project (ie. only square dimensions wored). I've never suffered from this problem though, so I'm not the most experienced in dealing with it. You're more than likely correct though :3
It doesn't need to be square, AFAIK.

Re: I have a question.

Posted: Mon Oct 25, 2010 5:27 pm
by com_1
LEN, MOD, SPLIT - is it possible on "Love2D" ?

If yes then how ?