PDA

View Full Version : glPixelTransferf



ada
07-31-2002, 09:08 PM
Hi!
Do you ever use glPixelTransferf(GL_channel_SCALE, ...)
I tried to but is extremly slow.
Can you tell me how can I multiply my color with a number greater than 1.
I want the result (R*c, G*c, G*c, A*c) where c>1.
Thanks.

AdrianD
08-01-2002, 07:59 AM
do it multipass:
----------------
A * 1.5 = (A * 1) + (A * 0.5)
(A can be red green blue or alpha)

pass1: draw with A=1 , no blending
pass2: glEnable(GL_BLEND);
glBlendFunc(GL_ONE,GL_ONE);
draw with A=0.5

another way:

pass1: draw with A=1.5/2, no blending
pass2: glEnable(GL_BLEND);
glBlendFunc(GL_DST_COLOR,GL_DST_COLOR);
draw with A=1

or:

pass1: draw with A=1.5/2, no blending
pass2: glEnable(GL_BLEND);
glBlendFunc(GL_ONE,GL_ONE);
draw with A=1.5/2


there many other ways, when you consider using extensions... but don't forget, this values are always clamped in the framebuffer to a maximum of 1, so if you want to accumulate light intensities over several passes that are higher than 1.0 you will probably need to use more than one rendering buffer and add then together in some kind of postprocessing pass...