[SDL] SDL_image load times

CRV§ADER /KY crusaderky at inwind.it
Thu Nov 14 09:27:02 PST 2002


> > The problem is not related to IMG_Load, that is just a bit slower than
> > SDL_LoadBMP.
> > What you're doing can result in compatibility problems:
> > An universally accepted texture, in fact, *must* be 64,128 or 256 wide
>or
> > high; any other resolution will cause problems.
> > Refer to NeHe's OpenGL tutorial #7.
> >
> > There are some workarounds for this:
> > 1)Resize your images using some art program.
>
>My reply to Jacek's post I've mentioned that it takes longer to load the
>1024x1024 image and not convert then it is to convert it from 800x600 to
>1024x1024.
I suggested you to resize them to 400x300.


>  A call to glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize)
>gives me 2048. Why is anything higher then 256 a problem if OpenGL tells
>me 2048 is the max? OpenGL seems to handle a texture of 1024x1024 just
>fine. I'm more concerned about is the file load + jpeg decoding times.

In NeHe's OpenGL tutorial is just said "compatibility reasons". That means 
that probably your program won't work on older video cards.
Email NeHe if you want more info.


> > 2)Use SDL_gfx to resize them realtime
> > However, this way stretched images will look awful.
>
>I'd prefer to keep them at their original quality. :/
>
> > 3)If you don't want to lose resolution, split them in many textures
>(not
> > recommended)
>
>I just tried splitting the image up into segments of 512 and smaller
>(with a power of 2) when needed. It ended up being 9 parts to it. The
>512x512 chunk alone took just under 50ms. This took as long as one
>800x600 image in total.
>
>I also tried with 6 parts and set a maximum size of 256 chunks. Both
>methods took as long. The best result out of all of that is 6 parts, but
>not much improvement over my current setup.
>
> > 3)Use mipmaps. They can have any size.
> > Just keep in mind that, while mipmaps have absolutely the best
>quality,
> > they use a BUNCH of RAM.
> > I attach some code of mine that uses the third option. It's based on
>Sam
> > Lantinga's version of NeHe's tutorials
>
>I'll give this a go, but doesn't it still require me to use SDL_image to
>load the image in the first place?
Of course, but
1)You don't have to mess up with the image. Just load it, correct it (take 
a look at the code I've sent you) and send it to the opengl function.
2)SDL_image isn't a problem, as it's practically as fast as SDL_LoadBMP 
(and even faster is your hard disk is slow).
However, loading textures of that dimension requires A LOT of time, 
whatever you do.




>Thanks
>
>Gerald
>
>_______________________________________________
>SDL mailing list
>SDL at libsdl.org
>http://www.libsdl.org/mailman/listinfo/sdl





More information about the SDL mailing list