change color buffer values

Oh and I know you can do the GL_LUMINANCE trick with glCopyTexSubImage2D, but I’m wondering if there’s a way to do this without using a texture (i.e. copy to an auxiliary buffer or something)

If the input is a pixmap you could change the pixel transfer options to achieve this as well.

Thanks for all your Posts - seems to be an interesting Thread! :wink:

eteq: the way you described seems to be what i was searching for in the first place, but unfortunately this seems to be too expensive, as you said.

btw: is there a function that does greyscale-rendering? This could probably help, too.

thanks

glDrawPixels or texturing with GL_LUMINANCE or GL_INTENSITY as the format. If you have a greyscale color buffer, everything would be grey, if that is what your are looking for.

Or just set-up final combiner to do luminocity color transform before you draw your scene (it is actual only if you scene doesn’t enable fragment shaders). I can give an example for nVidia cards using register_combiners extension.

OFFTOPIC: nice played against Ecuador )) don’t loose you winning velocity ))

I tried using glCopyTexImage2D with GL_LUMINANCE, but instead of determining the luminance values (as glReadPixels does with GL_LUMINANCE), it seems to be just using the red value to color the texture… any way around this? And is there some kind of generic register_combiner like the nVidia one (other than an actual shader, of course)?

and jtipton, how would the pixel transfer options help here? The values would have to change for every pixel, which would be very inefficient…

Luminance values are not computed for you by using a luminance texture. This means that the data is already in a luminance format.

I don’t see why you would need different pixel transfer options for each pixel. You can set up unique options for each color channel. I’m not even sure what this thread is about anymore. I must be on a different planet.

but glReadPixels DOES do that computation if you specify GL_LUMINANCE - I guess you’re right (i.e. its only drawing the first component), but then how do I do the conversion? Is it shader or nothing? k_szczech’s post seems to suggest that it is possible…

The quick way is to average the r,g,b values. I think this is waht ReadPixels does. There are other ways which include weighting each value according to the sensitivity of the human eye. We are more sensitive to blue than red and green. You can find that through a web search. Not of this will be fast, but it is an alternative to shaders if they are not available.

I know that’s what glReadPixels does - I already said I did that and it works, but reading to memory is slow - I want to do the same thing, but to a texture rather than CPU memory… But it sounds like that just isn’t possible without using a fragment shader.