View Full Version : grey client texture to LUMINANCE_ALPHA internal
11-22-2007, 03:01 AM
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.
11-22-2007, 09:38 PM
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?
11-23-2007, 03:23 AM
As the man page (http://www.opengl.org/sdk/docs/man/xhtml/glTexEnv.xml) 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 (http://www.opengl.org/sdk/docs/man/), they are the most up-to-date ones around.
12-13-2007, 05:35 AM
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.
12-13-2007, 07:37 AM
Ah found it! I wonder why GL_COMBINE is not in most of the documentation repositories. Is it very new/uncompatible with drivers?
No. It's old. Six years old. See: ARB_texture_env_combine (http://www.opengl.org/registry/specs/ARB/texture_env_combine.txt).
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.