Reputation: 1239
Is it possible to render a coloured texture in black and white using ES 1.X? If yes, how?
Upvotes: 0
Views: 434
Reputation: 100622
The only thing I can think of is very convoluted — using the GL_COMBINE texEnv mode to do a per-pixel dot product, though I can't seem to find a route through that doesn't involve an intermediate FBO and reducing the precision of your RGB channels to 7 bits a piece. So you're using the dot3 functionality that's generally intended for lighting, but because you don't want to use negative values you're ending up with half the available range. You'd basically just dot product everything with the vector (0.299, 0.587, 0.114) and output that on all three channels.
Upvotes: 4
Reputation: 25318
With a fragment shader that converts the color information into grayscale. Its pretty simple, just add all three channels and divide them with three (there are more advanced ways but this simple way works in most if not all cases).
Upvotes: 0