Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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);
share|improve this answer
    
That totally makes sense! Thanks a lot for that info :) –  Vite Falcon Nov 15 '11 at 22:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.