PDA

View Full Version : colour order BGR



mr_coolio
02-10-2003, 05:59 AM
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.

kehziah
02-10-2003, 06:46 AM
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).]

mr_coolio
02-10-2003, 08:04 AM
Originally posted by kehziah:
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).]


thanks!

Deiussum
02-10-2003, 08:38 AM
The standard gl.h for Windows also already has this:

#define GL_BGR_EXT 0x80E0
#define GL_BGRA_EXT 0x80E1

zen
02-10-2003, 06:13 PM
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.

Deiussum
02-11-2003, 05:34 AM
If using Windows, that particular extension will be available. It's available even in the default Microsoft software implementation.