Any hardcoded limit on image size?

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.
Post Reply
IQuit
Prole
Posts: 7
Joined: Mon Jan 02, 2012 2:51 am

Any hardcoded limit on image size?

Post by IQuit »

It seems to me that an image with 513x768 or 1024x768 draws fine but not 1025x768.
Tried love.graphics.newImage with ImageData as well as reading from a file.
I use v0.8.0 so should not be power of 2 syndrome. Is it just me having this problem?
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Any hardcoded limit on image size?

Post by vrld »

It's more than hardcoded, it is hardwired into your graphics card. With 0.8 the PO2 syndrome is not magically gone, it is just cleverly worked around by reserving memory for a PO2 image behind your back, if this is necessary (i.e. when your graphic card cannot handle non PO2 images). So the 1025x768px image will reserve 2048x1024px to prevent any issues.

Now, making the assumption that one pixel takes up 4 Byte (32 bit), this will allocate 2048 * 1024 * 4 Byte = 8 MB of graphics memory just for the image (without PO2 correction this would still take up 1025 * 768 * 4 Byte = ~3MB). Some graphic cards (especially older ones) don't have that amount of memory. Thus, they cannot load or show the image.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
IQuit
Prole
Posts: 7
Joined: Mon Jan 02, 2012 2:51 am

Re: Any hardcoded limit on image size?

Post by IQuit »

Thanks!
I am not quite sure, but it does not look like a memory limit, however.
Here is a short code to demonstrate the problem:

Code: Select all

local j,k={},{}
function love.load()
        table.insert(j,love.image.newImageData(2,1024))
        table.insert(j,love.image.newImageData(2,1025))
        table.insert(j,love.image.newImageData(1024,2))
        table.insert(j,love.image.newImageData(1025,2))
        table.insert(j,love.image.newImageData(1024,1024))
        for z=1,#j do
                for y=0,j[z]:getHeight()-1 do
                        for x=0,j[z]:getWidth()-1 do
                                j[z]:setPixel(x,y,222,44,111,255)
                        end
                end
                k[z]=love.graphics.newImage(j[z])
        end
end
function love.draw()
        for z=1,#k do
                love.graphics.draw(k[z],z*80+20,z*80+20)
        end
end
On my system, second and forth image show up as white while the rest are in pink.
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Any hardcoded limit on image size?

Post by Boolsheet »

It looks like your graphics card/driver can't load textures with a width or height equal or higher than 2048. What graphics card and driver do you have? Can you try to update the driver?
Shallow indentations.
User avatar
Ensayia
Party member
Posts: 399
Joined: Sat Jun 12, 2010 7:57 pm

Re: Any hardcoded limit on image size?

Post by Ensayia »

I remember having this issue when I made a screensaver for my mother using LOVE. You don't really think about the differences in older versus newer tech until it bites you. I made a large static image for a background and her laptop's puny Intel chip completely choked. Turns out it can't handle large sizes well at all! I really had to butcher the nice screensaver I made to get it to work at all on her machine.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Any hardcoded limit on image size?

Post by Jasoco »

For safety reasons I like to keep my images to 1024x1024 at most just in case. But you could play it safe at 512x512. If you need images bigger, you'd just use pieces and draw them tiled, but at least you'd be safe from cards that can't do really big images.

We;ve done a few polls before to see who can support what. My MacBook Air's integrated HD3000 card can support a large amount of large images, but a better full dedicated card might be more limited. It seems to depend on what the card maker decided to support at the time. It's silly I know. But there's nothing you can do except prepare and use smaller images.
IQuit
Prole
Posts: 7
Joined: Mon Jan 02, 2012 2:51 am

Re: Any hardcoded limit on image size?

Post by IQuit »

Thanks everyone for replying!
Yeah, I am using GMA950.
The problem is I cannot break up the image of a spritebatch or there will be issues with drawing sequence ...
I guess I will have to give up!
Wonder how other software handle this issue ...
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Any hardcoded limit on image size?

Post by Jasoco »

IQuit wrote:Thanks everyone for replying!
Yeah, I am using GMA950.
The problem is I cannot break up the image of a spritebatch or there will be issues with drawing sequence ...
I guess I will have to give up!
Wonder how other software handle this issue ...
They handle it by breaking up the images. Just break up the image. You'll have to do it anyway. Instead of having one large image in the spritebatch you might have 4 or so. But at least it would be compatible with more graphics cards.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot], Google [Bot] and 6 guests