Advertisement Jump to content
Sign in to follow this  

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

This topic is 4884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!