[Noob question / C++] Color masking

Started by
2 comments, last by SeeForever 10 years, 6 months ago

Hello. I'm working on a 2D program with OpenGL and I'm looking for a way to mask individual bits of colors. Something like glColorMask() but with float arguments instead of booleans, if that makes any sense.

To be more specific, I want the world environment in my program to have a blueish/whitish tone during winter and a slight orange tone during summer.

My program consists of flat square textures layered on top of each other. There are no 3D objects, so the advanced lighting mechanisms of OpenGL would be a little overkill.

Thanks in advance!

Advertisement

The easiest way is to just overlay a color and using blending

Your idea of masking individual bits probably wouldn't work like you expected it to, and you have little control over the results

Create a fullscreen quad (-1 to 1) for NDC and just shade any color you want

Or you could render your scene to an off-screen buffer and use it as a texture while drawing to the back buffer with a color correcting 3d texture.

With a 16x16x16 3d texture you can implement many many effects including saturation, hue, gamma, contrast, controlling individual channels etc ...

Cheers!

[edit] check the link http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter24.html

Gee, sorry for the late response! I had email notifications disabled.

The easiest way is to just overlay a color and using blending

Your idea of masking individual bits probably wouldn't work like you expected it to, and you have little control over the results

Create a fullscreen quad (-1 to 1) for NDC and just shade any color you want

What I ended up doing was something similar to that, except instead of making the entire texture red (for example) rendered every texture twice, one at glColor4f(1,1,1,0.5) and one at glColor4f(1,0,0,0.5). It did the trick. :)

Thanks!

This topic is closed to new replies.

Advertisement