Simplest method for additive colouring

Started by
2 comments, last by serenity 20 years, 5 months ago
Greets guys, I was wondering what the simplest method for increasing the level of a given colour (red or green or blue) on a textured quad would be? I know I can call glcolour(255,0,0), to draw with only the red components of a texture, of course, but if there is no red in the image, it means it appears as black, which is not what I want. I just want all the red to be exaggerated. Thanks for any help, Rob
Advertisement
Then don't remove the other color components completely by multiplying by zero. Multiply by something greater than zero, say, 128 to keep half of the other two components.

edit: This will not increase the red component, but decrease the other components. If you really want to increase it and keep the other, check out the GL_RGB_SCALE operation in the texture environment functions. Use that together with modulation to increase a color component.

[edited by - Brother Bob on November 8, 2003 8:24:40 PM]
I can decrease the other components, as you suggest, but this will simply tend the resulting texture towards black, encountering the problem I have now. I need to actually increase the red component.

How do I go about using the GL_RGB_SCALE operation, if you don''t mind me asking?
Set the texture environment combiers like this.
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PRIMARY_COLOR);glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE);glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCRALE, 2 or 4);

You can set the scale to 2 or 4, depending on how much you plan on boosting the colors. 2 means you cannot boost them more than 2x, same for 4.

Now you use the primary color to determine the exact gain. A color of 1.0/scale will result in no scaling, 1.5/scale will result in boosting it by 50%, and so on.

This topic is closed to new replies.

Advertisement