read gray image and color index image.

opengl core profile do not support GL_LUMINANCE and GL_COLOR_INDEX
how can I load texture Minimum Cost(do not convert).
For example, I have a image,8bit gray.Can I no convert to RGB and load to texture?

GL_LUMINANCE is replaced by GL_RED.
GL_LUMINANCE8 is replaced by GL_R8.

but on opengl 3.3 reference :

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.

this mean green and blue is 0,but gray image,green and blue is equal red,isn’t it?

In core profile, you will have to do your own fragment program anyway.
So it will end up with something like :

gl_FragColor.rgba = texture2D(texcoord).rrra

If you want to play with new functionality (>=GL3.3 or GL2.1 + GL_ARB_texture_swizzle), you can try:


        glTexParameteri(target, GL_TEXTURE_SWIZZLE_G, GL_RED);
        glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_RED);

thanks.Now I can handle grey image.

then index image (can get Palette,and data is Palette’s index);
I have to load two texture ,one is index data,Another is Palette data?