Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacement for GL_LUMINANCE, GL_LUMINANCE_ALPHA​

For memory-efficient realtime embedded graphics I have traditionally used DDS images encoded using GL_LUMINANCE when I need lossless grayscale images (or GL_LUMINANCE_ALPHA when there is alpha needed). However, I have just discovered that these file formats were deprecated in OpenGL 3 and removed from 3.1.

Is there a replacement image format for lossless grayscale-only data that is 8 bits per pixel or less (or 16bpp when alpha is involved)?

like image 750
Phrogz Avatar asked Nov 19 '13 16:11

Phrogz


1 Answers

If you scroll up a bit on that wiki page you'll see GL_RED/GL_R* and GL_RG* for 1- and 2-channel images.

glTexImage2D():

GL_RED: Each element is a single red component. The GL converts it to floating point and assembles it into an RGBA element by attaching 0 for green and blue, and 1 for alpha...

GL_RG: Each element is a red/green double. The GL converts it to floating point and assembles it into an RGBA element by attaching 0 for blue, and 1 for alpha...

As GuyRT pointed out if you have EXT_texture_swizzle/ARB_texture_swizzle and/or OpenGL version >= 3.3 you can use swizzle mask to expand out/rearrange your texture color components.

like image 102
genpfault Avatar answered Oct 25 '22 21:10

genpfault