2009/12/7 Timothée Lecomte <timothee.lecomte@lpa.ens.fr>

Le 7 déc. 09 à 00:00, Greg Ewing a écrit :

> Timothée Lecomte wrote:
>> As far as  alternatives to pure glTexSubImage2D, I have considered
>> and tried to  use PBO, but it does not decrease the time needed by
>> the two  glTexSubImage2D calls.
> This is puzzling, because transferring 1000 pixels of data
> shouldn't take very long, even if you're not doing it the
> most efficient way.
> The only thing I can think of is to try using different
> pixel formats for the texture data. Fastest CPU->GPU transfers
> occur when you use a pixel format that matches what the
> GPU uses, so that no conversions are needed.

That's an advice I've seen very often on opengl pages on the web. Is
there a way to know at runtime what is the native format ?

Thanks Greg.



Timing calls is the best way really.

Using two textures has been faster for me on multiple cards.  However switching to the best format gives a much bigger speed boost.  The two texture trick works well because it doesn't stall the card(s) as much as reading from the frame buffer.

There are also extensions on some cards/drivers to get the card to use system memory for specific textures... in which case it is just a memcpy to copy.  However that can be complicated, and only faster in some situations.