async texture loading

Using a four-component format (eg RGBA) will almost certainly be subtantially faster to upload than a three-component one (RGB, as you say you’re using).

I know libjpeg doesn’t like to decompress to four-component colors, but perhaps you could use an alternate image format or decompression library.

Of course, as the other say, uploading precompressed DXT textures is probably as fast as you can get…

ok, thank you for all replies, I’m still playing with my code, hope to get what I need with your help.

so two questions: how to tell driver (from my app) not compress my uncompressed textures when I call glTexImage2D? and do you know some library to compress textures (to do this in background thread and then pass small compressed data for uploading).

btw, I read in help for glTexImage2D that given data is converted to floats, “multiplied by the signed scale factor GL_c_SCALE, added to the signed bias GL_c_BIAS, and clamped to the range [0,1]” - so this isn’t a direct copy in any case?

Originally posted by OneSadCookie:
Using a four-component format (eg RGBA) will almost certainly be subtantially faster to upload than a three-component one (RGB, as you say you’re using).
Why would it be substantially faster ?

because of better data alignment

Originally posted by jide:
[quote]Originally posted by OneSadCookie:
Using a four-component format (eg RGBA) will almost certainly be subtantially faster to upload than a three-component one (RGB, as you say you’re using).
Why would it be substantially faster ?
[/QUOTE]From help for glTexImage2D:
“It is converted to floating point format and assembled into an RGBA element by attaching 1.0 for alpha.”
so alpha will be there in any case and function will return faster if alpha will be already there

most interesting thing is that under Linux my app works smoothly w/o any advanced methods (such as PBO) and under Windows it doesn’t. so I assume maybe there are some different defaults in drivers on differend systems…

These conversion rules in the spec are just to specify what the exact procedure is, but it would be silly to convert to float and back to an integer internal format with the default bias of 0.0 and scale of 1.0 because the data won’t change.
I also wouldn’t expect that RGB is expanded to RGBA if a hardware can support that format natively. It will save the memory for the alpha component knowing that the alpha should be 1.0 during usage of such textures.

Originally posted by ZbuffeR:
(I just played a bit with Google Earth : they seem to use only small textures)
That’s the default. Go to tools/options to change it…

I also wouldn’t expect that RGB is expanded to RGBA if a hardware can support that format natively. It will save the memory for the alpha component knowing that the alpha should be 1.0 during usage of such textures.
In practice, nVidia cards do not support 24bit RGB, they are all stored as 32bit RGBA (this makes DXT1 sound even greater in comparison since it’s just 4bits per pixel!!) I don’t know about ATI though…

how to tell driver (from my app) not compress my uncompressed textures when I call glTexImage2D?
Simple. If you set the internalformat to be compressed, then glTexImage will compress it on-the-fly, otherwise it won’t.

Originally posted by andras:
In practice, nVidia cards do not support 24bit RGB, they are all stored as 32bit RGBA
Mostly right, but check the last column here: http://developer.nvidia.com/object/nv_ogl_texture_formats.html

Hehe, so the GF6200 TurboCache supports it… Obviously in that card they did everything to save memory.

Originally posted by andras:
[quote]how to tell driver (from my app) not compress my uncompressed textures when I call glTexImage2D?
Simple. If you set the internalformat to be compressed, then glTexImage will compress it on-the-fly, otherwise it won’t.
[/QUOTE]it’s obvious, but how exactly to set internal format to be uncompressed?

Originally posted by pronvit:
[quote]Originally posted by andras:
[quote]how to tell driver (from my app) not compress my uncompressed textures when I call glTexImage2D?
Simple. If you set the internalformat to be compressed, then glTexImage will compress it on-the-fly, otherwise it won’t.
[/QUOTE]it’s obvious, but how exactly to set internal format to be uncompressed?
[/QUOTE]RTFM:

ie. GL_RGBA8 - 32 Bit UNCOMPRESSED