Support for LARGE images?

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
User avatar
Przemator
Party member
Posts: 107
Joined: Fri Sep 28, 2012 6:59 pm

Support for LARGE images?

Post by Przemator »

Hi. I am trying to make a racing game. A crucial part is the track. Many games I know use a large bitmap (MRO, Turbo Sliders). These games are neither advanced, nor recent and they run on really old PCs. The bitmaps we're talking about here go to 10,000 pixels in width.

As you might know, LOVE can load an image or create a canvas that is no larger than the maximum texture size of your graphics card. So the reality is, you should not be happy that your GeForce handles 4096x4096, because some laptop may handle only 512x512 and your game won't run on it. These games DO work on old hardware.

So my question is, do you know a way to open large images using LOVE, slice them up into tiles, be able to perform group transformations on it? It seems strange that these games can load, draw, move VERY large images and LOVE can't.

I think, many years ago, I tried some DirectX based game library (DelphiX ?) and I could load large images too. So is this support for large images only available for DirectX? If you're using OpenGL, you're out of luck?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Support for LARGE images?

Post by kikito »

AFAIK ImageData is not linked to the graphics card or OpenGL in any way (unlike Image) so it shouldn't have those problems.

Try loading the big image inside a ImageData, then create several smaller (512x512) ImageDatas and use ImageData:paste to draw the big one onto the smaller ones. Then you should be able to create one Image for each one of the smaller ImageDatas.
When I write def I mean function.
User avatar
Dattorz
Citizen
Posts: 66
Joined: Sat Oct 27, 2012 12:32 am
Contact:

Re: Support for LARGE images?

Post by Dattorz »

No, it's universal. Chances are the devs behind DelphiX made the decision to hide a lot of complexity by automatically splitting large images up into smaller textures. You'll need to do the same. First, you should establish a maximum texture size that you wish to support. This will determine your least common denominator hardware (I wouldn't use anything above 2048x2048). When it comes time to draw, you'll need to run a nested for loop for however many rows and columns of slices are on the screen, then draw the correct slices.

Watch out for texture memory limitations. If there's a lot of redundancy in your graphics you might even want to split them into smaller tiles to save on memory.
User avatar
Przemator
Party member
Posts: 107
Joined: Fri Sep 28, 2012 6:59 pm

Re: Support for LARGE images?

Post by Przemator »

OK thanks for response guys. So what if I wanted to edit this 10,000px imagedata? I open big image, split it into square pieces, then what? I want to draw some lines on it with love.graphics.line or put some smaller textures on it. As far as I know, you can't draw on an image.

Canvas, on the other hand, is not recommended to be used at all. How many people can have a problem with canvas, really? 1%, 10%?
User avatar
slime
Solid Snayke
Posts: 3163
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Support for LARGE images?

Post by slime »

Przemator wrote:Canvas, on the other hand, is not recommended to be used at all. How many people can have a problem with canvas, really? 1%, 10%?
Definitely use canvases, just be aware that your game will either have minimum system requirements (not particularly high ones though), or you'll have to make them optional.

~93% (rough estimate) of systems support canvases. The ones that don't probably either have very outdated graphics drivers, or hardware from over 10 years ago.
User avatar
Przemator
Party member
Posts: 107
Joined: Fri Sep 28, 2012 6:59 pm

Re: Support for LARGE images?

Post by Przemator »

Looking at the list, the biggest setback may be the Intel GMA 950 and Intel GMA X3100, which are still used on some modern laptops and Intel Atom (netbooks).
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Support for LARGE images?

Post by Nixola »

My dad's PC has a GMA X3100 but it supports (small) canvases
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Knaimhe
Prole
Posts: 34
Joined: Mon Jan 23, 2012 7:23 pm

Re: Support for LARGE images?

Post by Knaimhe »

Przemator wrote:As far as I know, you can't draw on an image.?
What...?
You're sure that you can't just...

Code: Select all

love.graphics.draw(ImageName, bunchO'Arguments)
love.graphics.line(x1, y1, x2, y2)
As long as the line is drawn after the image, it should appear on top of it.
Is there something huge I'm missing?
Admittedly, I've only done this with smallish images, but that shouldn't make a difference.

(If you've done this and can't see the line, try setting the color and line size to something ridiculous.)
User avatar
Przemator
Party member
Posts: 107
Joined: Fri Sep 28, 2012 6:59 pm

Re: Support for LARGE images?

Post by Przemator »

Knaimhe wrote:As long as the line is drawn after the image, it should appear on top of it.
Is there something huge I'm missing?
Indeed there is :), we're talking about editing the image. But it doesn't matter now, there is canvas for that.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], whateverest and 4 guests