16 bpp, 24 bpp, and 32 bpp textures in OpenGL

Started by
0 comments, last by MarkB 18 years, 7 months ago
So many of todays games give the user the option of choosing 16, 24, or 32 bit textures, giving the user the option to trade off quality for performace. My main question is this- how would you support these different formats in OpenGL, on Windows? My first thought was, you supply create different image files, saved in the 3 formats, and load the appropriate textures into OpenGL. Given that you use glTexImage2D() to define textures, you would need to specify correct params to that function. The format and type params are the appropriate ones. You pretty much have to use GL_RGB, or GL_RGBA as the format if you want to specify all 3 colors, which you do. The smallest type argument is a byte long, so you essientially can specify a minimum of 24 bits (3 colors x 1 byte = 24 bits). This line of thought brings up a few problems. First, there is no way to give it a 16 bit color. Now for 32 bits, well if you consider the alpha part of the bits it is techinally 32 bits. This gives rise to the question: When games give you the option of 16,24,32 bpp are they considering the alpha? So I do some more research and find that OpenGL 1.2 adds some extra possible arguments for the type param of the glTexImage2D(), for instance GL_UNSIGNED_SHORT_4_4_4_4. Maybe we are getting somewhere here. I'm using OpenGl 1.1 on windows and trying to figure out if I can use that value somehow, and of course it's not in the gl.h header because windows is stuck with it's OpenGL 1.1 implementation. I looked through _some_ of the extensions looking for these values, and not finding it. Is these extra values for the type field of glTexImage2D() in an extension? If not is there any way to use them in on Windows? Are all extra features in the OpenGL spec implemented as extensions? If they add new features to a spec without providing it as an extension, is it true that you can't use it on Windows? I wonder how quake does this letting you select different bpp... If someone can answer any of these questions or if I'm missing something big please let me know. Thanks!
Advertisement
I've found that the extension that I was looking for is GL_EXT_packed_pixels.

This topic is closed to new replies.

Advertisement