Jump to content
  • Advertisement
Sign in to follow this  
Wampus

OpenGL DirectX equivalent of glColorMask

This topic is 4821 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

I was wondering if anyone knew the DirectX equivalent of OpenGL's glColorMask. I'm basically trying to set up an anaglyph stereo scene that isn't depandant on the drivers for setting up the stereo. I'm trying to draw the red component from one viewpoint and all others from a different viewpoint. For OpenGL, I've done something similar rendering the left with glColorMask(true, false, false, false); then setting the right to glColorMask(false, true, true, true); I'm also using DirectX 8.1. Thanks in advance for any info.

Share this post


Link to post
Share on other sites
Advertisement
You could adjust the material for that, by zeroeing out the appropriate components. That is if you do not use the material for something else. Also you can control the gamma ramp (hardware dependent) and filter out the corresponding colors.

Greetz,

Illco

Share this post


Link to post
Share on other sites
Wampus,

You're looking for the D3DRS_COLORWRITEENABLE state. It can be used as follows

pD3DDevice->SetRenderState( D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED );

This would allow ALL color channels of the backbuffer to be written to. If you want to allow ONLY Green and Blue (Alpha and Red unmodified ) use

pD3DDevice->SetRenderState( D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN );

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!