grey client texture to LUMINANCE_ALPHA internal

Wow, the subject requirements are tight. I apologize for any confusion.

Basically I’m looking at a routine I’m overhauling that reads a grey texture from a file, then wants to give it to Opengl as a LUMINANCE_ALPHA texture with the values simply copied for the alpha component. I believe this is the only way we were able to achieve desirable blending properties – for a simple soft font with highly layered tranparencies type visuals.

I’m curious if there might be a way to let Opengl worry about this rather than allocating a temporary doublee sized buffer, and manually copying/duplicating the pixel values.

There’s no point in having the same values in two channels. Simply use the greyscale image as ALPHA texture. Both the COMBINE texenv and shaders allow you to take the alpha channel of a texture and copy it to the other color channels.

A manual shader is out, but I will look into/suggest the COMBINE parameter – which I am/was unaware of (if it checks out)

EDIT: Is “COMBINE” an extension btw? If some one can save me the detective work, I would appreciate it – it isn’t register combiners is it?

EDIT: Ah found it! I wonder why GL_COMBINE is not in most of the documentation repositories. Is it very new/uncompatible with drivers?

As the man page says:

“GL_COMBINE mode and its associated constants may only be used if the GL version is 1.3 or greater.”

Use the OpenGL SDK man pages, they are the most up-to-date ones around.


Well, while attempting to comprehend GL_COMBINE, I came across GL_INTENSITY! Which is the least invasive solution for this dilemma as it turns out.

No. It’s old. Six years old. See: ARB_texture_env_combine.

The reason it’s not mentioned much is that shaders obsolete all of it, providing a <u>much</u> simpler interface. Texture combine (i.e. register combiners) is like telling someone else how to wire up a breadboard, connection by connection, verbally. Versus high level shaders (Cg/GLSL/HLSL/etc.) where you just do it, often all in one expression or line.

If Cg/GLSL is like C++, texture combine is like microcode.

Also shaders afford you much greater flexibility in the expressions and logic you can use.