Jump to content
  • Advertisement
Sign in to follow this  
SeeForever

OpenGL [Noob question / C++] Color masking

This topic is 2108 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Edited by SeeForever

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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

Edited by kauna

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!