PDA

View Full Version : GL_RGB, GL_RGBA, GL_RGB8,..... what is what???



Jan
06-10-2002, 10:06 AM
Maybe you think, this is a beginner question, but i am not so sure, because i am totally confused.

My OpenGL-header (version 1.3) declares these constants:

GL_RGB
GL_RGB4
GL_RGB5
GL_RGB8
GL_RGB10
GL_RGB12
GL_RGB16

GL_RGBA
GL_RGBA2
GL_RGBA4
GL_RGBA8
GL_RGBA12
GL_RGBA16

GL_RGB5_A1
GL_RGB10_A2

Ok, i know, that if i want 16 Bit textures, i use GL_RGB16 or GL_RGBA16. But what do i use for 32 Bit textures? If i use GL_RGBA4 it might mean "4 Bytes", but what does then GL_RGBA8 mean, maybe "8 Bits per component", but it could also mean "8 Bits for all 4 components". And what is GL_RGB? Is it 24 Bits? But GL_RGB8 could also be 24 Bits, but it could also be "8 Bit for all three".

AAAAAAAAAAAHHHHHHHHHHHHHH! I could go on like this for hours!

And i tell you something else: Every single constant is defined different! There is none, which is just another constant for the same number, NO THEY ARE ALL DIFFERENT!

Help me please, before i totally go crazy!

Thanks in advance,
Jan.

Brent Fogarty
06-10-2002, 12:58 PM
Here is what I got out of the msdn library, remember that there is probably some padding of bits that occur when the number of bits used isn't byte aligned

Constant.....Base Format R Bits G Bits B Bits A Bits
GL_R3_G3_B2..GL_RGB......3......3......2..........
GL_RGB4......GL_RGB......4......4......4..........
GL_RGB5......GL_RGB......5......5......5..........
GL_RGB8......GL_RGB......8......8......8..........
GL_RGB10.....GL_RGB......10.....10.....10.........
GL_RGB12.....GL_RGB......12.....12.....12.........
GL_RGB16.....GL_RGB......16.....16.....16.........
GL_RGBA2.....GL_RGBA.....2......2......2.......... 2
GL_RGBA4.....GL_RGBA.....4......4......4.......... 4
GL_RGB5_A1...GL_RGBA.....5......5......5.......... 1
GL_RGBA8.....GL_RGBA.....8......8......8.......... 8
GL_RGB10_A2..GL_RGBA.....10.....10.....10......... 2
GL_RGB12.....GL_RGBA.....12.....12.....12......... 12
GL_RGBA16....GL_RGBA.....16.....16.....16......... 16

dorbie
06-10-2002, 02:36 PM
Of course the constants are different, what do you expect? They mean different things. :-)

This is the documentation you need from the OpenGL spec:
http://www.opengl.org/developers/documen...100000000000000 (http://www.opengl.org/developers/documentation/Specs/glspec1.1/node79.html#SECTION00680100000000000000)

Jan
06-11-2002, 03:24 AM
Thanks!

That was what i needed.

Jan.