I have a question.

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.
User avatar
com_1
Prole
Posts: 44
Joined: Fri Oct 22, 2010 11:54 pm
Location: No Comment

I have a question.

Post by com_1 » Sat Oct 23, 2010 12:22 am

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.

User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: I have a question.

Post by Tesselode » Sat Oct 23, 2010 12:29 am

Try making the width and height of the image a multiple of 2.

User avatar
Thursdaybloom
Citizen
Posts: 81
Joined: Mon Feb 15, 2010 3:43 am
Location: Australia

Re: I have a question.

Post by Thursdaybloom » Sat Oct 23, 2010 12:32 am

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

User avatar
com_1
Prole
Posts: 44
Joined: Fri Oct 22, 2010 11:54 pm
Location: No Comment

Re: I have a question.

Post by com_1 » Sat Oct 23, 2010 11:42 am

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.

User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: I have a question.

Post by zac352 » Sat Oct 23, 2010 12:37 pm

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.
Hello, I am not dead.

User avatar
Thursdaybloom
Citizen
Posts: 81
Joined: Mon Feb 15, 2010 3:43 am
Location: Australia

Re: I have a question.

Post by Thursdaybloom » Sat Oct 23, 2010 12:55 pm

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.

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: I have a question.

Post by TechnoCat » Sat Oct 23, 2010 4:11 pm

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.

User avatar
Thursdaybloom
Citizen
Posts: 81
Joined: Mon Feb 15, 2010 3:43 am
Location: Australia

Re: I have a question.

Post by Thursdaybloom » Sat Oct 23, 2010 10:30 pm

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

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: I have a question.

Post by Robin » Sat Oct 23, 2010 10:33 pm

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.
Help us help you: attach a .love.

User avatar
com_1
Prole
Posts: 44
Joined: Fri Oct 22, 2010 11:54 pm
Location: No Comment

Re: I have a question.

Post by com_1 » Mon Oct 25, 2010 5:27 pm

LEN, MOD, SPLIT - is it possible on "Love2D" ?

If yes then how ?

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests