DirectX equivalent of glColorMask

Started by
3 comments, last by JWalsh 18 years, 10 months ago
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.
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
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 );
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Awesome. Thanks Jeromy. That was what I was looking for.
No problem, kind sir. Glad I could help. =)
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints

This topic is closed to new replies.

Advertisement