PDA

View Full Version : Grayscale in textures



Gabba123XXL
12-19-2011, 05:24 PM
Hello,
I want to create textures that are in gray format, so it is cheaper to use a 8 bit per pixel than 24/32 bit.
Which "internal format" and "format" do you suggest to me for using in "glTexImage2D"?

Thanks in advance...

Alfonse Reinheart
12-19-2011, 06:19 PM
Here (http://www.opengl.org/wiki/Image_Format) is a comprehensive list of OpenGL image formats available. If you're using pre-GL 3.0, then you will probably want to use one of the INTENSITY or LUMINANCE formats, listed in the "Legacy Image Formats" section.

Gabba123XXL
12-20-2011, 07:41 AM
So I am using OpenGl spec 3.1. To save memory space on the graphics card, can I use GL_RED for internal format and format to declare a grayscale?
In the fragment shader I suppose, I have to output a color with three identical figures in RGB...

aqnuep
12-20-2011, 08:16 AM
More specifically, you should use GL_R8 as internal format (means 8 bit red).
Btw, you are right about the rest.

Gabba123XXL
12-20-2011, 12:54 PM
Thanks a lot!