Can I do these with shaders?

Hello all,
From what I have read, I can do many interesting things with shaders.
Is it possible to do these:

  1. Define ‘non standard’ texture formats, for example 16 bits textures.
  2. If 1) is possible, can I render such a texture in a way that the interpolated 16 bits number of the texels N, will be checked againts some values say v1, v2 etc. If N < v1 draw R1G1B1, if v1 =<N < v2 draw R2G2B2 etc. I mean N will serve as a pointer to a color LUT table.
  3. Can I apply a sort of image processing while drawing a texture? I mean is it possible that a fragment’s color is a user defined linear combination of neiboring texels?
  4. If the processor has several texture units, is it possible to apply different behaviours described in 1) and 2)to different texture units?
  5. When combining the these textures by multitexturing what are the combinations possibilities? Can I multiply two textures or only to blend them?

Hope the questions are clear enough…
Many thanks,

  1. depending on hw, you can even define standard textures with that format… a.k.a. GL_LUMINANCE16 or GL_LUMINANCE_ALPHA16 or such (it’s been a while).

1.) The hardware defines what textures are supported. It’s what you sent in the internalFormat parameter of glTexImage.
2.) Yes, in a fragment program.
3.) Yes, set your filtering to nearest, read the texels you want from a texture and combine them how you want.
4.) Yes, you can do texture accesses to any eanabled texture unit in one fragment program.
5.) Any formula you can program in fragment programs.