View Full Version : read gray image and color index image.
08-19-2010, 05:17 AM
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?
08-19-2010, 06:31 AM
GL_LUMINANCE is replaced by GL_RED.
GL_LUMINANCE8 is replaced by GL_R8.
08-19-2010, 10:04 PM
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?
08-19-2010, 11:45 PM
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
08-21-2010, 01:28 AM
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);
08-21-2010, 03:09 AM
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?
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.