[SDL] OpenGL Textures

David Olofson david.olofson at reologica.se
Mon Aug 13 12:56:00 PDT 2001

On Monday 13 August 2001 21:14, you wrote:
> > Then something is wrong with the OpenGL code. File formats have a
> > *specified* (if only implicitly by the platform the format originates
> > from) byte order, and you should stick to that. Messing with files
> > that appear to be of some well known format is generally a very bad
> > idea.
> Not necessarily. You can feed BGRA textures to OpenGL as opposed to
> RGBA or whatever; in fact, this makes GL code significantly faster on
> the Voodoo 1/2/3 chipsets: BGRA is the format that Glide wants, so Mesa
> is just going to have to convert every texture in software to get it to
> the card if you don't pass it in that format.
> OpenGL doesn't understand file formats: just chunks of memory with
> certain characteristics. You can feed it RGBA data and tell it it's
> BGRA if you want, but doing so explicitly doesn't make the OpenGL code
> or library incorrect.

I wasn't very clear; "Messing with files..." etc was meant as in 
"Creating files that don't contain data in the format their headers 
suggest, just to make the loader simpler." - or simply "Creating broken 
files." It just *can't* be a good idea IMO, and besides, it's not 
portable so it hardly even solves the problem! :-)

As to the original problem, the solution lies in knowing what the image 
loader generates (shouldn't be too hard with SDL_image), and how to 
describe it to OpenGL (almost easier).

//David Olofson --- Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
|      Multimedia Application Integration Architecture      |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------------> http://www.linuxdj.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> david at linuxdj.com -'

More information about the SDL mailing list