0
\$\begingroup\$

I'm trying to convert some DirectX code to Ogre3D and was wondering what the following translates to:

pDev->SetTextureStage(0, D3DTSS_TEXCOORDINDEX, 0)
pDev->SetTextureStage(0, D3DTSS_COLORARG1,     D3DTA_TEXTURE)
pDev->SetTextureStage(0, D3DTSS_COLOROP,       D3DTOP_MODULATE)
pDev->SetTextureStage(0, D3DTSS_COLORARG2,     0)

What is the modulation operation happening here? Is the texture getting modulated with the background? Or is it getting zeroed?

I've tried searching for what this means and unfortunately I haven't come across anything meaningful. Any help to shed light on this matter will be much appreciated.

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

This is one of the D3DTA macros; checking in d3d9types.h reveals that D3DTA_DIFFUSE is defined as 0x00000000 so that's the one.

It's obvious that the reason why is because you can bitwise-or these with various options, so the rendering backend is checking to see if the option to do so has been selected and is using a DWORD instead of the macro directly. E.g. it might look something like:

DWORD colorarg2option = D3DTA_DIFFUSE;
if (options.colorarg2 & something) colorarg2option |= D3DTA_COMPLEMENT;
if (options.colorarg2 & somethingelse) colorarg2option |= D3DTA_ALPHAREPLICATE;
pDev->SetTextureStage (0, D3DTSS_COLORARG2, colorarg2option);
\$\endgroup\$
1
  • \$\begingroup\$ That totally makes sense! Thanks a lot for that info :) \$\endgroup\$ Nov 15, 2011 at 22:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .