JBeurer
JBeurer

Reputation: 1717

How to render grayscale texture without using fragment shaders? (OpenGL)

Is it possible to draw a RGB texture as grayscale without using fragment shaders, using only fixed pipeline openGL?

Otherwise I'd have to create two versions of texture, one in color and one in black and white.

Upvotes: 0

Views: 1063

Answers (2)

Nicol Bolas
Nicol Bolas

Reputation: 473487

No. Texture environment combiners are not capable of performing a dot product without doing the scale/bias operation. That is, it always pretends that [0, 1] values are encoded as [-1, 1] values. Since you can't turn that off, you can't do a proper dot product.

Upvotes: 0

Hugh Fisher
Hugh Fisher

Reputation: 2516

I don't know how to do this with an RGB texture and the fixed function pipeline.

If you create the texture from RGB source data but specify the internal format as GL_LUMINANCE, OpenGL will convert the color data into greyscale for you. Use the standard white material and MODULATE mode.

Hope this helps.

Upvotes: 1

Related Questions