colour order BGR

How do you specify a texture when your memory block has the pixel colours in B-G-R order (instead of the usual R-G-B order)?

I thought there was this flag GL_BGR but now I can’t find it anywhere…

Thanks.

It is available as an extension. Comes in 2 flavours : GL_EXT_abgr (extension #1, dates back to 1995 (!)), and GL_EXT_bgra (which introduces BGRA and BGR formats).
You’ll find the specs here http://oss.sgi.com/projects/ogl-sample/registry/

EDIT : quick answer : #define GL_BGR 0x80E0
and use it where you need it (TexImage2D I guess). Learning the OpenGL extension mechanism would definitely be a bonus (will make you understand why and how some features are available as extensions, and how the OpenGL community make the lib evolve).

[This message has been edited by kehziah (edited 02-10-2003).]

Originally posted by kehziah:
[b]It is available as an extension. Comes in 2 flavours : GL_EXT_abgr (extension #1, dates back to 1995 (!)), and GL_EXT_bgra (which introduces BGRA and BGR formats).
You’ll find the specs here http://oss.sgi.com/projects/ogl-sample/registry/

EDIT : quick answer : #define GL_BGR 0x80E0
and use it where you need it (TexImage2D I guess). Learning the OpenGL extension mechanism would definitely be a bonus (will make you understand why and how some features are available as extensions, and how the OpenGL community make the lib evolve).

[This message has been edited by kehziah (edited 02-10-2003).][/b]

thanks!

The standard gl.h for Windows also already has this:

#define GL_BGR_EXT 0x80E0
#define GL_BGRA_EXT 0x80E1

If spped is not that critical you can just swap the components yourself(either in memory or when loading them from file) instead of relying on an extension which might not be available on other systems.

If using Windows, that particular extension will be available. It’s available even in the default Microsoft software implementation.