Is there a way to set the blending parameters so the whole scene renders in grayscale? (without using GLSL, only pipeline functions)
Thanks
Is there a way to set the blending parameters so the whole scene renders in grayscale? (without using GLSL, only pipeline functions)
Thanks
Hm, maybe if it was rendered to a luminoscity+alpha FBO, and then that drawn?
Well, either that or copied onto such a texture, then the texture back onto the FBO - that said, FBO's would be a better solution (if available) in most cases.
Please note that I haven't tested this.
Actually, for completeness sake, I'll mention that there is one possible solution if the GL_ARB_imaging extension is supported: the GL_COLOR_MATRIX, which transforms incoming RGBA values. You could set the upper 3x3 matrix to all 1/3.0 like so:
GLFloat graymat[] = {.33,.33,.33,0,.33,.33,.33,0,.33,.33,.33,0,0,0,0,1};
glMatrixMode(GL_COLOR_MATRIX)
glLoadIdentity()
glMultMatrixf(graymat)
However great this may sound, though, not all drivers support this in hardware, which means that depending on your opengl implementation, your driver might: A) ignore the color matrix totally, B) fall back to software rendering, or C) (if the extension is not supported) raise a GLError.
If you are writing your code for a limited set of platforms, and they support this extension, then it would be the easiest way. Otherwise, you'll need another approach.